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

Add fallback for /etc #4

Closed
wants to merge 1 commit into from
Closed

Add fallback for /etc #4

wants to merge 1 commit into from

Conversation

9p4
Copy link

@9p4 9p4 commented Sep 1, 2022

If there is no config found, fallback to a system-wide config in /etc/meow.conf

@faynopi
Copy link
Owner

faynopi commented Sep 1, 2022

We do not produce configuration at /etc/meow.conf by default; instead, it is generated in $HOME/.meow.conf or $XDG CONFIG HOME/meowfetch/meow.conf. As a result, we don't require a backup for it.

At the parser function, we additionally check to see if a directory exists.
https://github.com/Itsnexn/meowfetch/blob/b1274473994a072854ce663fa5f4b1b434beaec6/configs/config.go#L53
As a result, I don't believe we need a fallback value for this function.

@faynopi faynopi closed this Sep 1, 2022
@faynopi faynopi added the invalid This doesn't seem right label Sep 1, 2022
@9p4
Copy link
Author

9p4 commented Sep 1, 2022

There is an application for this. When calling meowfetch as part of a motd script, the script does not have environment variables initialized. Since the os.UserHomeDir and os.LookupEnv both use environment variables to get the location of the configuration, there ought to be a way for the system to fallback to a system-wide config.

https://pkg.go.dev/os#UserHomeDir

@faynopi
Copy link
Owner

faynopi commented Sep 1, 2022

When calling meowfetch as part of a motd script, the script does not have environment variables initialized.

I don't understand what you mean by motd script.

Since the os.UserHomeDir and os.LookupEnv both use environment variables to get the location of the configuration, there ought to be a way for the system to fallback to a system-wide config.

there is no system-wide configuration. the program will generate config by itself if it does not exist.

https://github.com/Itsnexn/meowfetch/blob/b1274473994a072854ce663fa5f4b1b434beaec6/configs/config.go#L52-L70

please open an issue about this problem and we could continue this conversation there.

I think the best approach would be to copy the config file using the makefile at the install time. we could remove the embed and then change the parser.

@9p4
Copy link
Author

9p4 commented Sep 1, 2022

Continuing in #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants