Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

config(5) [linux man page]

config(5)							       Files								 config(5)

NAME
config - Configuration file. DESCRIPTION
A configuration file contains values for configuration parameters for the applications in the system. The erl command line argument -config Name tells the system to use data in the system configuration file Name.config . Configuration parameter values in the configuration file will override the values in the application resource files (see app(5) ). The val- ues in the configuration file can be overridden by command line flags (see erl(1) ). The value of a configuration parameter is retrieved by calling application:get_env/1,2 . FILE SYNTAX
The configuration file should be called Name.config where Name is an arbitrary name. The .config file contains one single Erlang term. The file has the following syntax: [{Application1, [{Par11, Val11}, ..]}, .. {ApplicationN, [{ParN1, ValN1}, ..]}]. * Application = atom() is the name of the application. * Par = atom() is the name of a configuration parameter. * Val = term() is the value of a configuration parameter. SYS.CONFIG When starting Erlang in embedded mode, it is assumed that exactly one system configuration file is used, named sys.config . This file should be located in $ROOT/releases/Vsn , where $ROOT is the Erlang/OTP root installation directory and Vsn is the release version. Release handling relies on this assumption. When installing a new release version, the new sys.config is read and used to update the appli- cation configurations. This means that specifying another, or additional, .config files would lead to inconsistent update of application configurations. There- fore, in Erlang 5.4/OTP R10B, the syntax of sys.config was extended to allow pointing out other .config files: [{Application, [{Par, Val}]} | File]. * File = string() is the name of another .config file. The extension .config may be omitted. It is recommended to use absolute paths. A relative path is relative the current working directory of the emulator. When traversing the contents of sys.config and a filename is encountered, its contents are read and merged with the result so far. When an application configuration tuple {Application, Env} is found, it is merged with the result so far. Merging means that new parameters are added and existing parameter values overwritten. Example: sys.config: [{myapp,[{par1,val1},{par2,val2}]}, "/home/user/myconfig"]. myconfig.config: [{myapp,[{par2,val3},{par3,val4}]}]. This will yield the following environment for myapp : [{par1,val1},{par2,val3},{par3,val4}] The behaviour if a file specified in sys.config does not exist or is erroneous in some other way, is backwards compatible. Starting the runtime system will fail. Installing a new release version will not fail, but an error message is given and the erroneous file is ignored. SEE ALSO
app(5) , erl(1) , OTP Design Principles Ericsson AB kernel 2.14.3 config(5)

Check Out this Related Man Page

Mojolicious::Plugin::JSONConfig(3pm)			User Contributed Perl Documentation		      Mojolicious::Plugin::JSONConfig(3pm)

NAME
Mojolicious::Plugin::JSONConfig - JSON configuration plugin SYNOPSIS
# myapp.json { "foo" : "bar", "music_dir" : "<%= app->home->rel_dir('music') %>" } # Mojolicious my $config = $self->plugin('JSONConfig'); # Mojolicious::Lite my $config = plugin 'JSONConfig'; # Reads "myapp.json" by default my $config = app->config; # Everything can be customized with options my $config = plugin JSONConfig => {file => '/etc/myapp.conf'}; DESCRIPTION
Mojolicious::Plugin::JSONConfig is a JSON configuration plugin that preprocesses it's input with Mojo::Template. The application object can be accessed via $app or the "app" function. You can extend the normal config file "myapp.json" with "mode" specific ones like "myapp.$mode.json". A default configuration filename will be generated by decamelizing the application class with "decamelize" in Mojo::Util or from the application filename. The code of this plugin is a good example for learning to build new plugins, you're welcome to fork it. OPTIONS
Mojolicious::Plugin::JSONConfig inherits all options from Mojolicious::Plugin::Config and supports the following new ones. "template" # Mojolicious::Lite plugin JSONConfig => {template => {line_start => '.'}}; Attribute values passed to Mojo::Template object used to preprocess configuration files. METHODS
Mojolicious::Plugin::JSONConfig inherits all methods from Mojolicious::Plugin::Config and implements the following new ones. "parse" $plugin->parse($content, $file, $conf, $app); Process content with "render" and parse it with Mojo::JSON. sub parse { my ($self, $content, $file, $conf, $app) = @_; ... $content = $self->render($content, $file, $conf, $app); ... return $hash; } "register" my $config = $plugin->register($app, $conf); Register plugin in Mojolicious application. "render" $plugin->render($content, $file, $conf, $app); Process configuration file with Mojo::Template. sub render { my ($self, $content, $file, $conf, $app) = @_; ... return $content; } SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojolicious::Plugin::JSONConfig(3pm)
Man Page