Config File without Environment Variable - sql

I don't have permission to create the Environment variable and I want to pass my Config file path and Name using variable.

Can you use one of the other configuration methods (SQL Server or XML)? Since you have file access, using XML seems appropriate.
See the section for "Types of Configurations":
http://msdn.microsoft.com/en-us/library/cc895212.aspx

Related

How to read the properties defined in config server inside the express

I have config server which is a containerized. now my task to create a API in express. the problem i am facing is how to read the common properties defined in the config server in my express api.
Create a .env File to store your environment variables. Example: .env.development or .env.test or .env.production files that you can put into a config folder.
Download the node module "node-foreman" https://github.com/strongloop/node-foreman
Now run your web server using foreman and specify which environment you want with the following command line command.
./node_modules/foreman/nf.js --env ./config/.env.development start web=1
That will load the correct environment that you want.
Then to access your environment variables in the actual code, you use "process.env".
For example if you have a key-value pair in your .env file like version=5.5 then to access it in the code you do process.env.version.

How to use an environment variable in the odoo.conf

I am trying to use an environment variable in the odoo.conf
file to specify the path where the logs are stored.
So far I have tried:
logfile = ${test.rueda}/odoo.log
But it does not work.
Is there any way to achieve this?
The Odoo configuration files do not support access to environment variables.
I can think of 2 possible approaches:
Use relative paths. The file names in the configuration are relative to the working directory of the Odoo server process. Start the Odoo server in different directories, one for every purpose, and keep the same structure relative to that.
Use environment variables in the command line. When starting the Odoo server, any configuration option can be passed using -- (2 dash signs) as a prefix. In the start script, you can then use environment variables as in any other shell script.
See https://www.odoo.com/documentation/11.0/reference/cmdline.html for details.
For referencing files or path:
When i work without external disk (where i can find my datadir):
i use in odoo config file data_dir = my_absolute_path_in_my_local_disk.
This path have a symbolic redirection to where is my local physical location of my local data directory
When my external disk come back, i change the symbolic link:
my_absolute_path_in_my_local_disk -> my_external_disk_..._data

Moqui Config Pulling Machine Environment Variables

Is there a way to set the database config using environment variables that the host machine has set e.g.
<inline-jdbc pool-minsize="1" pool-maxsize="2">
<xa-properties user="{RDS_USERNAME}" password="{RDS_PASSWORD}"
serverName="{RDS_HOSTNAME}" portNumber="{RDS_PORT}" databaseName="tenantcommon"/>
</inline-jdbc>
This is so that I can commit the database settings without committing the database passwords etc, which is also very useful for CI, staging and production using the same database file but each of them having different environment variables?
The approach Moqui is designed for is to keep multiple runtime conf XML files, like variations on the MoquiStagingConf.xml and MoquiProductionConf.xml files. While these files can be in the runtime directory they don't have to be. In previous versions you had to use a ../foo/etc relative path for it to be outside the runtime dir, but now you can start the path with a forward slash to specify the full path to the runtime conf XML file.
You may have various other settings that vary by environment, more than just DB settings, so this approach handles all of them and you just have one runtime environment variable to set, the conf XML file to use.

How to get environment information in Mule

I need to put some production specific behavior in mule-config.xml. Is there a way to get environment info in mule?
You can access all system properties via MEL. But I would rather suggest you modularize your configuration in several files (say: common-config.xml, test-config.xml, prod-config.xml) and load the right files at Mule startup based on the environment.
And also you can create properties file for each environment and access it inside mule config file.
You can create xml file with all the configurations and import/load the file into mule project
In your Mule configuration file (src/main/app/app-config-file.xml), you can add the following line:
<context:property-placeholder location="${environment.name}.properties" />
${environment.name} must be a system environment variable. You need to make sure the system where you are deploying your app contains that variable. I think you can also specify it in the Maven build, if you are using Maven (clean install -Denvironment.name=test). You can try.
To test locally, right click on your project, select run as, select run configurations, click on Environment tab, add your variable "environment.name" and the value "local" (without quotation marks) and make sure your local.properties file exists in a location added to the build path. It can be src/main/app for example or in the resources folder.
MEL has some context objects like server, mule ,application using these you can get the envinformation from #[server.env] for more info refer
https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-basic-syntax
You can use different mule properties file like Mule-dev.properties , mule-test.properties.
In global elements add a property placeholder :
In mule-app.properties define env= test or dev depending on the env value which you want to use.
Clean the project and deploy. Sometimes it is not able to read the env specific properties. Cleaning the project solves this issue.
You can add a properties file in you project and refer it from property place holder. it is better to add environment value in mule-app.properties file ehich is in /src/main/app
you can have one variable like mule.env in this mule-app.properties and send value to this Property as DEV,QA,UAT,PROD from cloudhub properties and create different properties file in mule/src/app main resources then use Properties placeholder to configure this property file and send the value of mule-env dynamically from cloudhub
Typically the way this is done is to delcare a property bean in which you set the environment specific value like PROD,QA,DEV or local. This environment specific value is set in mule-app.properties like mule.env=local, This needs to be set to the environment we are trying to deploy it and the API picks up the right properties file.

How do I configure Mercurial to use environment variables in mercurial.ini

How can I modify the mercurial.ini file to include an environment variable such as %userprofile%.
Specific situation:
I am learning to use Mercurial. I have modified the [ui] section of Mercurial.ini (in my home path) to include:
ignore = c:\users\user\.hgignore
Where user is my username literal. The .hgignore file includes filename filters that are used to ignore files during commit. How can I alter it from being the a literal user to an environment variable $user?
It won't interpolate environment variables in the hgrc, but I do believe that tilda expands to your home/profile directory correctly even on windows.
So:
ignore = ~/.hgignore
should work on windows and elsewhere (even the slashes get spun the wrong way automatically for you).
For other variables you'd need to get a little tricker and write a batch/cmd file that does the interpolation in advance and then hands the result off to mercurial for processing.
The mercurial.ini parses the environment variables just fine.
From my mercurial.ini:
[ui]
ignore = %USERPROFILE%/.hgignore
Works like a charm. Windows 7 Ultimate x64, Mercurial 1.5 (binary installation). The hgignore file is honored both my the command line hg.exe, and tortoiseHG.