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

[suggestion] layered configuration and relative path in configuration #162

Open
oliverdding opened this issue Jun 1, 2024 · 0 comments
Open

Comments

@oliverdding
Copy link

oliverdding commented Jun 1, 2024

Nice work! I was thinking about writing a snippets manager some time before then I saw this project.

But there are something to improve in configuration. People would include their dotfiles in sync, so a absolute path (like db_dir = '/home/username/.local/share/the_way_db') would not be a good idea, since the username would change in different devices.


At first, I think the path should just start from user home, for example: db_dir = '.local/share/the_way_db', but this would break the backforward compatibility. So I suggest accepting relative path (such as ~) or environment variable (such as $HOME, $XDG_DATA_HOME) in the configuration file.

Take another project for example, gopass is a password manager, which also encounter this issue, see also: issue and pull request.


Another advice is layered configuration. I have seen the default configuration implementation in the code, but if you delete some line in ~/.config/the-way/default-config.toml, such as db_dir, the-way would panic with error like can't parse config file.

That is not good behavior. I think the-way should accpect part of the whole configuration and use the default one if it's not provided. See also The Twelve-Factor App.

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

1 participant