首页 \ 问答 \ 在Rancher中通过环境变量覆盖Eureka配置(Override Eureka config via environment variable in Rancher)

在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
更新时间:2023-08-23 12:08

最满意答案

也许这可能有用:

  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

相关问答

更多
  • 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 ...
  • 您正在尝试直接从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 ...
  • 您的两个示例代码段都将失败,因为它们正在查找无命名空间中的元素。 您的第二个示例也将失败,因为您在根元素下查找license元素,而实际上它是根元素。 您需要使用正确的命名空间。 例如,要修复您的第一个查询(因为看起来它正在执行您想要的更多操作),您将使用: XNamespace ns = "http://http://lilleker-it.co.uk/"; var query = doc.Descendants(ns + "license").Select(s => new ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。