Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Support multiple config files #43

Open
rustysys-dev opened this issue Jun 10, 2020 · 1 comment
Open

Proposal: Support multiple config files #43

rustysys-dev opened this issue Jun 10, 2020 · 1 comment

Comments

@rustysys-dev
Copy link
Contributor

rustysys-dev commented Jun 10, 2020

I was thinking today about team use cases for adrust, and in particular having multiple projects for which you are writing adrs for.

to support this usecase, I propose a configuration profile manager. Since the configuration file is written in TOML, this manager could support the following.

  • create named profiles
  • current/default profile
  • import other config files (you could save a config file in git repository and share it)

to express this visually I have the following examples:

to create the config for the first example:

adr config new --name profile1              # create a new profile with default values
adr config default --name profile1          # set profile1 as default configuration profile
adr config set --name log_level --value 4   # set parameter value as currently done.
...
adr config new --name profile2
adr config set --name log_level --value 4 --profile profile2
...

example config 1:

default = "profile1"

[profile1]
log_level = 4
adr_src_dir = '/tmp/adr-samples/src'
adr_template_dir = '/tmp/adr-samples/templates'
adr_template_file = 'adr-template-v0.1.adoc'
adr_search_index = '/tmp/adr-samples/.index'
use_id_prefix = true
id_prefix_width = 6

[profile2]
log_level = 4
adr_src_dir = '/tmp/adr-samples/src'
adr_template_dir = '/tmp/adr-samples/templates'
adr_template_file = 'adr-template-v0.1.adoc'
adr_search_index = '/tmp/adr-samples/.index'
use_id_prefix = true
id_prefix_width = 6

to create the config for the second example:

adr config new --name profile1 --from /path/to/config/file.toml        # Create file with defaults if !exists
adr config new --name profile2 --from /path/to/second/config/file.toml # Create file with defaults if !exists
adr config default --name profile2

example config 2:

default = "profile2"

[profile1]
config_source = '/path/to/config/file.toml'

[profile2]
config_source = '/path/to/second/config/file.toml'

or you could mix and match the styles:

adr config new --name profile1              # create a new profile with default values
adr config default --name profile1          # set profile1 as default configuration profile
adr config set --name log_level --value 4   # set parameter value as currently done.
...
adr config new --name profile2 --from /path/to/second/config/file.toml # Create file with defaults if !exists

example config 3:

default = "profile1"

[profile1]
log_level = 4
adr_src_dir = '/tmp/adr-samples/src'
adr_template_dir = '/tmp/adr-samples/templates'
adr_template_file = 'adr-template-v0.1.adoc'
adr_search_index = '/tmp/adr-samples/.index'
use_id_prefix = true
id_prefix_width = 6

[profile2]
config_source = '/path/to/second/config/file.toml' 
@omallassi
Copy link
Owner

+1

Indeed, in my context, all Dcsion Records are in the same git repo so the need for N config was not obvious. yet it could be in other context :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants