configuration-files

how to read custom property files with command line argument in a spring boot application

余生长醉 提交于 2020-01-05 13:33:53
问题 when startup my spring boot application, I want to set a custom config file path by using command line argument, for example: java -jar some.jar -DConfigPath=conf/config.local(or conf/config.prod) So how to read this file to generate a spring configuration? Can I use the Annotation @PropertySource in some "dynamic" way? 回答1: Ok, I find the annotation @PropertySource can get the value injected by command line argument @Configuration @ConfigurationProperties @PropertySource(value = "file:$

play! application.conf content that's bit of confusing

微笑、不失礼 提交于 2020-01-05 08:09:48
问题 I am using play 1.2.3, in the application.conf, it has the following settings. What does each setting mean? It seems both are turned on, which one will take the priority? And also, if I remove the first setting (DEV mode), I don't get the PROD mode when run the app, am I missing anything? # Application mode # ~~~~~ # Set to dev to enable instant reloading and other development help. # Otherwise set to prod. application.mode=dev %prod.application.mode=prod 回答1: application.mode is run by

What is the relationship between Web.Config connection strings and ServiceConfiguration connection strings in Azure?

痴心易碎 提交于 2020-01-05 03:07:30
问题 I'm relatively new to Windows Azure and I need to get a better appreciation of how the Azure platform handles connection string configuration settings. Assume I have an ASP.Net web project and this has a Web.Config connection string setting like the following: <add name="MyDb" connectionString="Data Source=NzSqlServer01;Initial Catalog=MyAzureDb;User ID=joe;Password=bloggs;" providerName="System.Data.SqlClient" /> I use this connection string for local testing and such. Let's assume I have a

Is it possible to reuse Keys in Web.Config?

房东的猫 提交于 2020-01-04 12:48:55
问题 I want to share a folder between two web applications, so I tried to do the following: <add key="SharedFolder" value="D:\tfs\PlacasV1\Aplicacion Placas DataCenter\Integracion.Reclamos\Web-PRbranch1\"/> <add key="Claims.ControlGen.OutputDir" value="SharedFolder\restricted\controls\generated\"/> <add key="Claims.ControlGen.CsTemplatePath" value="SharedFolder\restricted\templates\CustomFieldsControl.ascx.cs.temp"/> <add key="Claims.ControlGen.AscxTemplatePath" value="SharedFolder\restricted

How to manage Configuration Settings for each Developer

被刻印的时光 ゝ 提交于 2020-01-03 19:13:10
问题 In a .NET project, say you have a configuration setting - like a connection string - stored in a app.config file, which is different for each developer on your team (they may be using a local SQL Server, or a specific server instance, or using a remote server, etc). How can you structure your solution so that each developer can have their own development "preferences" (i.e. not checked into source control), but provide a default connection string that is checked into source control (thereby

Editing PHP files for configuration via PHP

牧云@^-^@ 提交于 2020-01-03 06:08:29
问题 First of all, I am assuming this is NOT bad practice due to various popular software using this method, such as SMF. Anyway, so I currently have this code: <?php // main visual config $cfg['lang'] = 'en'; // paths $path['admin'] = 'index.php?p=admin'; $path['admin2'] = 'zvfpcms/admin'; $path['root'] = 'zvfpcms'; $path['images'] = 'zvfpcms/img'; $path['css'] = 'zvfpcms/css'; $path['js'] = 'zvfpcms/js'; $path['pages'] = 'zvfpcms/pg'; ?> The thing is, I want the $cfg variable(s) to be edited

Editing PHP files for configuration via PHP

心不动则不痛 提交于 2020-01-03 06:08:13
问题 First of all, I am assuming this is NOT bad practice due to various popular software using this method, such as SMF. Anyway, so I currently have this code: <?php // main visual config $cfg['lang'] = 'en'; // paths $path['admin'] = 'index.php?p=admin'; $path['admin2'] = 'zvfpcms/admin'; $path['root'] = 'zvfpcms'; $path['images'] = 'zvfpcms/img'; $path['css'] = 'zvfpcms/css'; $path['js'] = 'zvfpcms/js'; $path['pages'] = 'zvfpcms/pg'; ?> The thing is, I want the $cfg variable(s) to be edited

How to tell WCF client to read settings out of different config file?

不打扰是莪最后的温柔 提交于 2020-01-03 05:43:10
问题 I'm building a component that is an extension for another software product. It's loaded as a dll into that product, and therefore I don't have control over the main exe's app.config file. My component uses WCF and I'd like to be able to configure it using a .config file instead of programmatically within the code. Is there a way to tell WCF to get all the binding etc settings from a specific config file? 回答1: The .NET config file mechanism is scoped by AppDomain, so in principle you could

Reference variable from another ini section

假装没事ソ 提交于 2020-01-02 02:48:15
问题 Is it possible to reference a variable within an ini from another section? I know you can do the following [env] dir = /home/a dir2 = %(dir)s/b But what happens if I have two sections and want to reference the variable from that section? [env] name = DEV [dir] home = /home/<name from env here>/scripts Thanks 回答1: See the documentation on Python 3's configparser. Create a parser with extended interpolation. Use ${section:option} syntax to reference options from other sections. from

boost::program_options - how to handle multiple sections with the same name in INI file

蓝咒 提交于 2020-01-02 02:38:06
问题 In a config like below; is there a way to handle individual sections. I am looking for a way to validate individual "server" sections below, in a reliable manner. [basic] number_of_servers=3 [server] ip=10.20.30.40 password=sdfslkhf [server] ip=10.20.30.41 password=sdfslkhf [server] ip=10.20.30.42 password=sdfslkhf [server] password=sdfslkhf [server] ip=10.20.30.42 回答1: When using boost::program_options to parse a INI file, the option names must be prefixed by their enclosing section names.