This document is a DRAFT — please leave comments.
Whenever you're trying some new project, you'll likely have to configure something.
This mostly uses one of the following approaches:
- Copy the sample config file the project provides, understand the properties and change them
- RTFM to find out how to create the config file out of thin air
see this Github search to give you an idea.
What if we had a common way of interactively creating config files?
- You clone a project
- The project contains a file that describes its configuration:
- format of the config file(s)
- required keys and values
- description of the meaning of all keys (possibly including examples)
- You run a command, interactively answering questions.
- You end up with a valid config you understand.
Let's say the config description is in JSON format:
{
"config.yml": {
"format": "yml",
"entries": {
"instagram.client_id": {
"question": "What is the client identifier (client_id) you received when you registered your Instagram app?"
},
"instagram.client_secret": {
"question": "What is the client secret you received when you registered your Instagram app?"
}
}
}
}
When you run, let's say, interview
:
Let's create a valid configuration for this project…
Q: What is the client identifier (client_id) you received when you registered your Instagram app?
A: foo
Q: What is the client secret you received when you registered your Instagram app?
A: bar
and you end up with this in config.yml
:
instagram:
client_id: foo
client_secret: bar
- Do not allow the
target
to point out of the project directory (either directly by specifyingtarget
to be/etc/passwd
or via symlinks) - By default, do not overwrite existing files
- Re-running the command might update the configuration