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

Crash when not find config file #25

Open
qarmin opened this issue Dec 12, 2020 · 3 comments
Open

Crash when not find config file #25

qarmin opened this issue Dec 12, 2020 · 3 comments

Comments

@qarmin
Copy link

qarmin commented Dec 12, 2020

I think that randy should load default(builtin) config when not found any.
It is strange that after installation we need to create/copy config file because it crash when we don't do it

thread 'main' panicked at 'Unable to open/read ./config/default.yml', src/main.rs:661:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Przerwane (zrzut pamięci)
@iphands
Copy link
Owner

iphands commented Dec 15, 2020

Yeah I think Im getting closer and closer to that... there are now quite a few defaults that are assumed... but still you must include at least one config file.

FWIW when packaged I was putting the config file in a known place like /usr/share/randy/config
See: https://github.com/iphands/randy/blob/main/packaging/gentoo/randy.ebuild#L131

So if Randy is packaged this should be a non issue even though the config is externalized.

@ssokolow
Copy link

What I do with my own creations is embed the default config file using include_str! which can be written out using an option like --write-conf <path>... of course, I tend to want a default config that I can then use in a fallback chain via figment.

Either way, not a good idea to crash rather than displaying a clean failure message. When I saw the crash, my eyes glossed over the reason for the failure as I rushed to re-run it with RUST_BACKTRACE to figure out where the bug was.

@iphands
Copy link
Owner

iphands commented Apr 30, 2021

+1 on both accounts!

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

3 participants