The following documentation is automatically generated. Please do not edit this file, but rather the original, inline with Myriad::Config at lib/Myriad/Config.pm (on the system that originally ran this). If you do edit this file, and don't want your changes to be removed, make sure you change the first line.
Myriad::Config
Configuration support.
The %DEFAULTS hash provides base values that will be used if no other configuration file, external storage or environment variable provides an alternative.
%DEFAULTS
The %FULLNAME_FOR hash maps commandline shortcuts for common parameters.
%FULLNAME_FOR
A registry of configs defined by the services using the config helper.
config
A collection of Ryu::Observable to notify services about updates on the configs values
Delete a single config the best use case for this sub is during tests.
Delete all the config that has been parsed by this module, the best use case for this sub is during tests.
A helper to resolve the correct service config
input is expected to look like <service_name>_[configs|instances].<key>
and this sub will set the correct path to key with the provided value.
Example:
dummy_service.configs.password
will end up in
$config->{services}->{dummy_service}->{configs}->{password}
it takes:
subarg - the arguments as passed by the user.
subarg
root - the level in which we should add the sub arg, we start from $config->{services}.
root
value - the value that we should assign after resolving the config path.
value
Parse the arguments provided from the command line.
There are many modules that can parse command lines arguments but in our case we have unknown arguments - the services configs - that might be passed by the user or might not and they are on top of that nested.
This sub simply start looking for a match for the arg at hand in %DEFAULTS then it searches in the shortcuts map and lastly it tries to parse it as a subarg.
Currently this sub takes into account flags (0|1) configs and config written as: config=value
Tries to find environments variables that start with MYRIAD_* and parse them.
Fill the config from the config file
this sub doesn't do much currently since the config structure is modelled exactly like how it should be in the file so it just read the file.
Takes a service base package and its current name and tries to resolve its config from:
1. The framework storage itself (i.e Redis or Postgres ..etc). 2. From the config parsed earlier (cmd, env, file).
and if it fails to find a required config it will throw an error.
it takes
pkg - The package name of the service, will be used to lookup for generic config
pkg
service_name - The current service name either from the registry or as it bassed by the user, useful for instances config
service_name
Tries to find the config key in the storage using Myriad::Storage.
service_name - The service name.
instance - If the service has many instances (e.g demo, production) this should the identifier.
instance
key - The required config key (e.g password, username ..etc).
key
BUILDARGS
Deriv Group Services Ltd. DERIV@cpan.org.
DERIV@cpan.org
See "CONTRIBUTORS" in Myriad for full details.
Copyright Deriv Group Services Ltd 2020-2021. Licensed under the same terms as Perl itself.
To install Myriad, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Myriad
CPAN shell
perl -MCPAN -e shell install Myriad
For more information on module installation, please visit the detailed CPAN module installation guide.