Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Nov 25, 2022
1 parent 25df40c commit 2a78a56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
19 changes: 15 additions & 4 deletions docs/userguide/deployment.rst
Expand Up @@ -17,17 +17,18 @@ Running the launcher is very straightfoward:

.. code-block:: bash
asphalt run yourconfig.yaml [your-overrides.yml...]
asphalt run yourconfig.yaml [your-overrides.yml...] [--set your.component.param=your_value]
Or alternatively:

python -m asphalt run yourconfig.yaml [your-overrides.yml...]
python -m asphalt run yourconfig.yaml [your-overrides.yml...] [--set your.component.param=your_value]

What this will do is:

#. read all the given configuration files, starting from ``yourconfig.yaml``
#. merge the configuration files' contents into a single configuration dictionary using
:func:`~asphalt.core.utils.merge_config`
#. read the command line configuration options passed with ``--set``, if any
#. merge the configuration files' contents and the command line configuration options into a single configuration dictionary using
:func:`~asphalt.core.utils.merge_config`. The command line configuration options have precedence over the configuration files.
#. call :func:`~asphalt.core.runner.run_application` using the configuration dictionary as keyword
arguments

Expand Down Expand Up @@ -105,6 +106,16 @@ least ``INFO`` level to the console. You may want to set up more granular loggin
configuration file. See the
:ref:`Python standard library documentation <python:logging-config-dictschema>` for details.

Passing configuration at the command line
-----------------------------------------

With the above configuration file saved as ``config.yaml``, you could override the mailer's host
and the ``data_directory`` with:

.. code-block:: bash
asphalt run config.yaml --set mailer.host=smtp.my_other_company.com --set data_directory=/some/other/file/somewhere
Using data from environment variables and files
-----------------------------------------------

Expand Down
5 changes: 2 additions & 3 deletions src/asphalt/core/cli.py
Expand Up @@ -93,13 +93,12 @@ def run(
if "." in key:
ks = key.split(".")
last_i = len(ks) - 1
d = config["component"]["components"]
d = config["component"].setdefault("components", {})
for i, k in enumerate(ks):
if i == last_i:
d[k] = value
else:
d[k] = d.get(k, {})
d = d[k]
d = d.setdefault(k, {})
else:
config["component"][key] = value

Expand Down

0 comments on commit 2a78a56

Please sign in to comment.