Skip to content

Commit

Permalink
docs: Add documentation about gallia.toml and hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Oct 28, 2022
1 parent 297dff8 commit c043380
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration

## gallia.toml

All `gallia` settings stem from the commandline interface.
The documentation for all available settings per subcommand is available via `-h/--help`.
Frequently used settings can be put in a configfile which is called `gallia.toml`.
Settings from the config file set the **default** of the respective commandline option.
The config can always be overwritten by manually setting the relevant cli option.

The configuration file `gallia.toml` is written in [TOML](https://toml.io/en/).
Inheritence is not supported; the first file is loaded.
The `gallia.toml` file is loaded from these locations (in this particular order):

* path specified in the env variable `GALLIA_CONFIG`; see {doc}`../env`.
* current directory
* current Git root (if the current directory is a Git repository)
* `$XDG_CONFIG_HOME/gallia/gallia.toml`
* `~/.config/gallia/gallia.toml`

Only some cli options are exposed to the config file.
The available config settings can be obtained from `gallia --template`.
The output of `--template` is maintained to be up to date and is intended as a starting point.

## Hooks

`gallia` supports hooks for preparation or cleanup/postprocessing tasks.
Alternatively, they can be useful for e.g. sending notifications about the exit_code via e.g. matrix or ntfy.sh.
Hooks are shell scripts which are executed before (= pre-hook) or after (= post-hook) the `main()` method.
These scripts can be specified via `--pre-hook` or `--post-hook` or via `gallia.toml` as well.

The hook scripts have these environment variables set:

GALLIA_HOOK
: Either `pre` or `post`.

GALLIA_ARTIFACTS_DIR
: Path to the artifactsdir for the current testrun.

GALLIA_EXIT_CODE
: Only set for post-hooks; is set to the exit_code which `gallia` will use after the hook terminates.
For instance GALLIA_EXIT_CODE different from zero means that the current testrun failed.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Acting as a generic interface, the [logging](https://fraunhofer-aisec.github.io/
setup
automation
config
transports
env
logging
Expand Down

0 comments on commit c043380

Please sign in to comment.