Skip to content

Commit

Permalink
feat(configuration): load config from directory (#4616)
Browse files Browse the repository at this point in the history
This allows specifying paths to a combination of files and directories with the --config option provided none of the specified file paths reside directly inside one of the specified directory paths. The directory paths are not recursive, and load .yml and .yaml files at this time.
  • Loading branch information
james-d-elliott committed Dec 22, 2022
1 parent 2eb8200 commit cc1e58e
Show file tree
Hide file tree
Showing 66 changed files with 570 additions and 197 deletions.
16 changes: 16 additions & 0 deletions docs/content/en/configuration/methods/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ weight: 101200
toc: true
---

## Loading Behaviour

There are several options which affect the loading of files:

| Name | Argument | Description |
|:-----------------:|:-------------------------------:|:----------------------------------------------------------------------------------:|
| Files/Directories | `--config`, `-c` | A list of file or directory (non-recursive) paths to load configuration files from |
| Filters | `--config.experimental.filters` | A list of filters applied to every file from the Files or Directories options |

__*Note:* when specifying directories and files, the individual files specified must not be within any of the
directories specified.__

## Formats

The only supported configuration file format is [YAML](#yaml).
Expand Down Expand Up @@ -164,6 +176,10 @@ The name used to enable this filter is `template`.
This filter uses the [Go template engine](https://pkg.go.dev/text/template) to render the configuration files. It uses
similar syntax to Jinja2 templates with different function names.

Comprehensive examples are beyond what we support and people wishing to use this should consult the official
[Go template engine](https://pkg.go.dev/text/template) documentation for syntax instructions. We also log the generated
output at each filter stage as a base64 string when trace logging is enabled.

#### Functions

In addition to the standard builtin functions we support several other functions.
Expand Down
7 changes: 4 additions & 3 deletions docs/content/en/reference/cli/authelia/authelia.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ An open-source authentication and authorization server providing
two-factor authentication and single sign-on (SSO) for your
applications via a web portal.

Documentation is available at: https://www.authelia.com/
General documentation is available at: https://www.authelia.com/
CLI documentation is available at: https://www.authelia.com/reference/cli/authelia/authelia/

```
authelia [flags]
Expand All @@ -41,8 +42,8 @@ authelia --config /etc/authelia/config/
### Options

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
-h, --help help for authelia
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ authelia access-control --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ authelia access-control check-policy --config config.yml --url https://example.c
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/reference/cli/authelia/authelia_build-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ authelia build-info
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/reference/cli/authelia/authelia_crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto certificate --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto certificate ecdsa --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ authelia crypto certificate ecdsa generate --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ authelia crypto certificate ecdsa request --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto certificate ed25519 --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ authelia crypto certificate ed25519 request --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ authelia crypto certificate ed25519 request --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto certificate rsa --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ authelia crypto certificate rsa generate --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ authelia crypto certificate rsa request --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto hash --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ authelia crypto hash generate --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ authelia crypto hash generate argon2 --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
--no-confirm skip the password confirmation prompt
--password string manually supply the password rather than using the terminal prompt
--random uses a randomly generated password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ authelia crypto hash generate bcrypt --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
--no-confirm skip the password confirmation prompt
--password string manually supply the password rather than using the terminal prompt
--random uses a randomly generated password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ authelia crypto hash generate pbkdf2 --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
--no-confirm skip the password confirmation prompt
--password string manually supply the password rather than using the terminal prompt
--random uses a randomly generated password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ authelia crypto hash generate scrypt --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
--no-confirm skip the password confirmation prompt
--password string manually supply the password rather than using the terminal prompt
--random uses a randomly generated password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ authelia crypto hash generate sha2crypt --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
--no-confirm skip the password confirmation prompt
--password string manually supply the password rather than using the terminal prompt
--random uses a randomly generated password
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ authelia crypto hash validate '$5$rounds=500000$WFjMpdCQxIkbNl0k$M0qZaZoK8Gwdh8C
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ authelia crypto pair --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ authelia crypto pair ecdsa --help
### Options inherited from parent commands

```
-c, --config strings configuration files to load (default [configuration.yml])
--config.experimental.filters strings applies filters in order to the configuration file before the YAML parser, options are 'template', 'expand-env'
-c, --config strings configuration files or directories to load (default [configuration.yml])
--config.experimental.filters strings list of filters to apply to all configuration files, for more information: authelia --help authelia filters
```

### SEE ALSO
Expand Down

0 comments on commit cc1e58e

Please sign in to comment.