在Rancher中通过环境变量覆盖Eureka配置(Override Eureka config via environment variable in Rancher)
我在Rancher的容器中部署了一个Spring Boot应用程序。 我想通过Rancher中容器上设置的环境变量覆盖application.yml中的配置。 这是我想要设置的配置:
eureka: instance: prefer-ip-address: false hostname: fqdn.api.stuff.com nonSecurePort: 65230
我尝试了以下等价物,但它似乎不起作用:
- EUREKA_INSTANCE_PREFERIPADDRESS
- EUREKA_INSTANCE_HOSTNAME
- EUREKA_INSTANCE_NONSECUREPORT
什么是适当的拼写?
I have a Spring Boot application deployed in a container on Rancher. I would like to override the configuration which is in application.yml via the environment variables set on the container in Rancher. Here is the configuration that I would like to set:
eureka: instance: prefer-ip-address: false hostname: fqdn.api.stuff.com nonSecurePort: 65230
I tried the following equivalents but it doesn't seem to work:
- EUREKA_INSTANCE_PREFERIPADDRESS
- EUREKA_INSTANCE_HOSTNAME
- EUREKA_INSTANCE_NONSECUREPORT
What would be the appropriate spelling ?
原文:https://stackoverflow.com/questions/46786030
最满意答案
也许这可能有用:
XDocument doc = XDocument.Load("partners.xml"); XElement root = doc.Root; var id = from el in root.Elements("partner").Elements("idAsign") select el; foreach (var el in id) { comboBox1.Items.Add(el.Value.ToString()); }
我知道这不适合您的代码(comboBox),但我想展示如何获取“idAsign”节点的值。
基本上,它做了什么,它获得了所有“idAsign”值。 如果您将它们列在列表中,则很容易获得特定的列表。
its easy just had to get the especific node and then get the value after calling the method who obtains the node in a XML format like
<idAsign>12345</idAsign>
as follows
public XElement GetValuePartnerByID(string rutaPart, string id, string node) { XDocument archivoXML = XDocument.Load(rutaPart); XElement valuePart = (from c in archivoXML.Elements("partners").Elements("partner") where c.Element("id").Value == id select c.Element(node)).FirstOrDefault(); return valuePart; }
and then
XElement userID = metodosXML.GetValuePartnerByID(path, item.IdPartnerCard, "idAsign"); idAsig = int.Parse(userID.Value.ToString());
thanks
相关问答
更多-
如何获取LINQ-to-XML处理的元素类型?(How can I get the type of element being processed by LINQ-to-XML?)[2022-06-26]
XElement.Name是你要追求的吗? (使用XName.LocalName属性,然后获取元素名称的本地部分。) 如果你能说出你想要的输出,那会有所帮助:)(我原本以为你的意思是节点的类型 (属性,元素等),但在你的情况下它总是XElement ...) Is XElement.Name what you're after? (Use the XName.LocalName property to then get the local part of the element name.) If you ... -
所以我在下面编写的代码将生成树视图。 我正在使用的treeview类位于命名空间System.Web.UI.WebControls中。 然而,该函数是O(n ^ 3)。 public void ProcessXml(string document) { var doc = XDocument.Parse(document, LoadOptions.None); var uniqueSystemList = doc.Element("SNS").Elements ...
-
好吧,根据你发布的内容,看起来你的listingAgentElements实际上包含2个枚举 - 一个来自_xElement.Descendants("commercial") (即使只有一个, .Descendants返回一个可枚举列表),第二个来自.Elements("listingAgent") 我猜错了,并说你发布的XML,你的for循环只运行一次? 这意味着它循环遍历_xElement.Descendants的枚举,因此commercial实际上是另一个包含所有3个listingAgent的可枚举 ...
-
一个xpath不能包含一个斜杠,而你要向远一个级别。 它应该是 var xpath = @"//*[@name='productCode'][@value='Data']//..//.."; var s = xdoc.XPathSelectElement(xpath). ... An xpath can't contain a single slash, and you're going one level to far up. It should be var xpath = @"//*[@name=' ...
-
也许这可能有用: XDocument doc = XDocument.Load("partners.xml"); XElement root = doc.Root; var id = from el in root.Elements("partner").Elements("idAsign") select el; foreach (var el in id) { comboBox1.Items.Add(el.V ...
-
是的 - 你只是错过了命名空间: string desiredId = "4bd7b5ac-cb29-4d34-97be-deaebe4a5186"; XNamespace ns = "http://schemas.datacontract.org/2004/07/Stuff"; var pbp = (from b in data.Descendants(ns + "Item") where b.Element(ns + "Id").Value == desiredId ...
-
你知道构造函数需要另一个XElement来创建它的副本,你试过了吗? var copiedChildren = from folder in _xmlDataSource.Descendants("Folders").Descendants("Folder") where folder.Attribute("PathValue").Value.Contains(sourcePathValue) select new XE ...
-
C#Linq到XML元素(C# Linq to XML Element)[2022-11-19]
您正在尝试直接从USER_LOGIN元素和CONTENT元素获取DATE元素; 你需要访问他们的孩子元素。 (请原谅我使用方法语法而不是查询语法 ,这是我更喜欢的) 要点在这里 var dateElements = doc.Descendants("NewDataSet") // gather all the child-elements of all NewDataSet elements .SelectMany(dataSetEle => dataSetEle.Elements()) // filt ... -
如果路径中的任何部分不存在,您可以使用这些扩展名为您提供默认值。 Get中的最后一个路径部分可以是元素或属性。 它还将为您找出命名空间。 tbAuthor author = (from c in cdafile.Root.Elements(ns + "author") select new tbAuthor { streetAddressLine = c.Get("assignedAuthor/addr/stree ...
-
LINQ to Xml选择元素(LINQ to Xml Select Element)[2022-08-24]
您的两个示例代码段都将失败,因为它们正在查找无命名空间中的元素。 您的第二个示例也将失败,因为您在根元素下查找license元素,而实际上它是根元素。 您需要使用正确的命名空间。 例如,要修复您的第一个查询(因为看起来它正在执行您想要的更多操作),您将使用: XNamespace ns = "http://http://lilleker-it.co.uk/"; var query = doc.Descendants(ns + "license").Select(s => new ...