I created a project using rebar called "mything". I added lager as a dependency. Now how do I configure lager? I tried adding a "lager" section to "env" in mything.app.src but it doesn't seem to get those settings. I guess I don't know where env settings for dependencies are supposed to go.
You need to create config_name.config file which contains list of configurations for each appliaction you want to configure:
[{mything, [...]},
{lager, [...]}].
Then you can pass it to erl using option -config config_name. It's called system configuration and it overrides default environment properties from .app files. In releases it's usually named sys.config.
Resources for you: Configuring an Application and config.
Related
I have 2 .properties files for my project on hybris .
First one is used for CI process and as a result a got 4 zip files with my already built platform(after ant production).
On my prod instance i need to switch to another properties because there are all my connections to extended services such as mysql solr.. etc
How i can do that without running all ANT steps.
. ./setantenv.sh && sync && ant config -Denv=my_new_properties
then ./hybrisserver.sh start doesn't work.
There is no information on wiki https://cxwiki.sap.com/display/release5/ant+production+improvements
Check if Updating Configuration Settings at Runtime will be useful for you. You will need to use the FileBasedConfigLoader class and the runtime.config.file.path property.
Other best practices include using system variables for secure settings like DB URL. See "Using Environment Variables instead of Files for Secure Settings" section in Configuring the Behavior of SAP Commerce.
Another option you can look at is to have different config folders for different environments (e.g. config-dev, config-prd), and pass it to ant. e..g -Denv=config--dev
I want to use Schemacrawler lint in my project and wants to use custom lints only. Based on documentation , it says we can use command -linterconfigs=[path to linter XML configuration file] But when I tried creating XML configuration file and use the custom lints only, I still see default linters are running. Am I doing anything wrong ?
Here is the steps I followed:
download and unzip the package
create dump database named example.database
created schemacrawler-linter-configs.xml with one of the existing lint
Using following command to run the lint on dump database from _schemacrawler directory
./schemacrawler.sh --server=postgresql -command=lint -linterconfigs=schemacrawler-linter-configs.xml -database=example.database
Rashmi, SchemaCrawler runs all linters by default. You need to turn off any linters you don't need in the linters config file. Here is an example of how you can do it:
<schemacrawler-linter-configs>
<linter id="schemacrawler.tools.linter.LinterForeignKeyMismatch">
<run>false</run>
</linter>
</schemacrawler-linter-configs>
Sualeh Fatehi, SchemaCrawler
I am trying to set my environment variables to
$env:DEBUG="*,-babel"
But I cant figure out where to use this setting in the Atom editor
To make the shell's environment variables available to Atom, install following two small atom packages:
env-from-shell
auto-run
env-from-shell settings: enter comma delimited list of needed environment variables in it's settings panel. Check off auto-run box.
auto-run settings: if not already present, enter env-from-shell:copy in it's settings panel. A benefit of the env-from-shell package is no external configuration files have to be moved from directory to directory as projects change.
Try setting
process.env.DEBUG = "*,-babel"
in your (new) $HOME/.atom/init.coffee init file.
(Your directory may vary, see your process.env.ATOM_HOME.)
I have a node that runs several applications. These applications each have specific env settings. When I generate a release I start my node by just running ./rel/mynode/bin/mynode start. Is there an option that I could add to this command to override apps' env settings?
To answer your question: No, there is no parameter that you can pass into that command to load a different application env file.
However, if you are trying to load a different config file, for example a development file vs. a production file, you should check out how to do dynamic configuration with rebar.
I use it for running my application between different configured environments (production, and local testing).
I don't quite get what you mean by env settings. If you mean the applications configuration parameters that are set in the {Par,Val} tuples of the key env in the .app files then these can also be overridden in a system configuration file or directly in the command line. See the Configuring an Application section.
I'm building a release with Reltool. The app needs config files to start. It reads a config file using the following function:
read_config(Filename) ->
{ok, [Config]} = file:consult(filename:join(
[filename:dirname(code:which(?MODULE)),
"..", "config", Filename])),
Config.
What's a good way to use config files so that Reltool builds a working release?
In case you need more specialized config files rebar allows you to copy files into your release, eg. into a etc folder under your app (rebar creates etc by default) using the overlay option in your reltool.config file (overlay is not a standard reltool config option):
%% reltool.config
{overlay, [{copy, "../path/foo.config", "etc/foo.config"}, ...
You can pass the config file as argument to the vm using the vm.args file:
%% vm.args
-config etc/foo.config
Your start script should pass the vm.args file as argument to the vm (again rebar generates a script that does that automatically).
The function init:get_argument allows you to read more specialized arguments to the vm, eg:
%% vm.args
-very_special_config etc/foo.config
and
case init:get_argument(very_special_config) of
{ok, Arg} -> Arg;
_ -> fail
end
You do not need to have your own config file, unless it's for very special purpose.
If your config file is different from version to version, you can have those different config to your <application>/ebin/<application>.app.
You can setup your default config variables to your <application>/ebin/<application>.app.
For more details about this, please refer to http://www.erlang.org/doc/man/app.html
Then, you are ready to use the config variables by using
application:get_env(<application_name>, <key>, <default_value>).
If not defined, you can also set with application:set_env/3.
For more, please look at this http://www.erlang.org/doc/man/application.html
Then you can also override those application variables by defining <any_name_or_system_name>.config, then use that one when you start with erl command with --config <file_name>.config. You can take a look at this for starting command options, http://www.erlang.org/doc/man/erl.html
When you start a command, you can also override the config variables by using -<application> <key> <value>.
You may also take look at this for config file syntax for your application.
http://www.erlang.org/doc/man/config.html
Once you have succesfully built an OTP application, it will seem very easy to you.