I'm using the flyway command line tool. I'd like to setup different configuration settings for different environments (development/testing/production), but there will be some common settings. Ideally there can be a common.properties config, along with individual environment-specific configs (e.g. production.properties)
Does flyway support including properties from multiple config files in some way?
Yes, you can by exploiting the loading order of Flyway config files (http://flywaydb.org/documentation/commandline/#configFile)
Place the common settings in either
Flyway Install Dir/conf/flyway.conf
User Home Dir/flyway.conf
Current Dir/flyway.conf
You can then put the environment-specific properties in the file you specify with
-configFile=/path/to/envspecific.conf
Related
I am building this ASP.Net Core MVC Application. Thing is I want to keep three different environments for my Databases, Like Development, Sandbox & Production. Is there any way I can mention that in my app setting file or will I need to manually specify in the deployment like I normally do? Like I am deploying a self-contained application on Elastic Beanstalk & for now, I have edited the appsettings.json file with the required database but that is just like one DB at a time.
"ConnectionStrings": {
"DefaultConnection": "Server = tcp:<Remote DB Server>,1433; Database = <DB>; User Id = <DB Username>; Password = <DB PASS>;"
TL:DR; Can I have multiple Connection strings as per the enviroment in my appsettings.json file?
As per the configuration by environment chapter of the official documentation, you have a few options for this:
To load configuration by environment, we recommend:
appsettings files (appsettings.<>.json). See Configuration: File configuration provider.
environment variables (set on each system where the app is hosted). See Configuration: File configuration provider and Safe storage of app secrets in development: Environment variables.
Secret Manager (in the Development environment only). See Safe storage of app secrets in development in ASP.NET Core.
The first option is a very common solution for environment-specific configuration and simply involves in additional appsettings.json files that include the environment name in the file name. The default templates already come with a appsettings.Development.json file that is only loaded for the Development environment. Similarly, you could create a appsettings.Sandbox.json and a appsettings.Production.json file that are loaded with the Sandbox and Production environment respectively.
The configuration files are loaded in addition to the normal appsettings.json file, so you can use that to specify general defaults and only overwrite environment-specific things in the environment-specific appsettings.<Environment>.json files.
Note that you should always try to avoid putting production secrets in files, especially those that are committed to source control. For those, you can also use environment variables to overwrite specific values. For example, an environment variable ConnectionStrings__DefaultConnection could contain the connection string for your application and would overwrite what is configured in one of the appsettings files.
I found lots of document talking about Oracle Coherence cluster configuration bur did't know where to put it, default configuration files location in coherence.jar but I don't think these files meant to be modified, I am using coherence with Weblogic 12c
I found the answer it should be put on the class path of the application, files with postfix override like tangosol-coherence-override.xml should override default configuration in coherence.jar
<!-- jBoos Configuration ->
<!-- Local -->
mysql configuration
I want to enable both not comment any one of configuration. which configuration is setup depend by windows environment likelinux or windows
Here is one way to do it, sort of manually:
Keep the configuration outside the application war-files.
The project repository contains sample config-files for different needs.
On your machine, or on the server, simply create (or copy from sample) the needed config file.
In spring, read in the config like this:
<context:property-placeholder location="file:/etc/project-name/config.properties"/>
The path /etc/... works on windows also. It points towards c:\etc...
My application supports running on many dbms and it requires user to configure dbms connection setting and also provide the jdbc jar file.
Now the application is to be packaged as OSGi bundle. There will be another main jar which lanches OSGi server and starts the application as bundle.
Can you please suggest how can I package the application as bundle and let user provide the jdbc jar file.
Will it require something like the main launcher jar specifying JDBC driver classes as FRAMEWORK_SYSTEMPACKAGES property?
Thanks in advance,
Aman
There are two ways of doing this:
1) Adding the driver.jar to the classpath of the main launcher and, like you say, expose its packages via the framework by specifying that property (or actually you can use the FRAMEWORK_SYSTEMPACKAGES_EXTRA property to just specify additional packages, instead of specifying all of them).
2) Manually wrapping the driver.jar as a bundle, or doing it dynamically at runtime. For example, you could try to wrap bundles that are copied to a certain folder (similar to what Apache Felix File Install does) by using Pax URL or some other tool that can create a bundle out of an ordinary jar file for you (see http://team.ops4j.org/wiki/display/paxurl/Pax+URL).
Is it possible to configure an IIS site to read ASP.Net settings from a site OTHER than web.config?
We'd like to have three config files in our codebase -- web-dev.config, web-test.config, and web-prod.config. Each IIS instance would be configured to read from their specific file. This way we have version control them all next to each other (and one-click deploy the entire site) but know that each IIS instance will read the settings specific to itself.
I've found in IIS where it shows where the web.config is, but I can't see how to change the location.
I use the configSource property to specify an external config file for sections that need different values for dev and production.
<connectionStrings configSource="Config\ConnDev.config"/>
Then you only have to change one setting (manually or with a tool) to switch from Dev to Production configs.
The best solution right now is to use different configs for development and production. This however will change with .net 4 and VS 2010 which they have added Web.Debug.config, Web.Release.config, Web.Staging.config and Web.Testing.config which will then publish the config you need in relation to the environment.
At my company we just have our deployment tool set to copy the appropriate file to web.config depending on what kind of deployment we're doing.
I believe it has to be named web.config.
You are facing a common problem.
One solution that I have used that worked really well in a large organization was to set environment variables on the web servers. Such as DEV, QA, UAT, PROD. Then, in code, you can query the environment variable to see which machine you are on, and then choose the values of appSettings accordingly. For example, you could have a database connection string named DEVconnection, and another named UATconnection. If your code determines from the environment variable that you are on UAT, then it would use UATconnection.
This does assume that you have the ability to set environment variables on the web server. In this instance, the admins running the servers were the ones who suggested this solution.
What was sweet about this was that there was ever only one version of web.config.
I do not think we can make web.config declaratively so that we can specify different config file. One thing you can do you can split your configuration file and set for different environments.
Please go through this article
http://jetmathew.wordpress.com/2011/02/07/split-web-config-for-different-environment/
cheers