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

Loading config from /etc/cow folder #328

Open
fzerorubigd opened this issue May 18, 2015 · 6 comments
Open

Loading config from /etc/cow folder #328

fzerorubigd opened this issue May 18, 2015 · 6 comments

Comments

@fzerorubigd
Copy link
Contributor

Its helpful to try to load config from /etc/cow folder, IF the ~/.cow is not available.

@cyfdecyf
Copy link
Owner

Good suggestion. I'll implement this recently.

@cyfdecyf
Copy link
Owner

@fzerorubigd let's switch to this issue to discuss. What about the following behavior:

  • The order to find config file:
    1. Get from command line option
    2. if not specified on command line, try $HOME/.cow/rc
    3. fallback to /etc/cow/rc
    4. exit if there's no config file
  • Once we resolved the config file, blocked and direct file are to be read in the same directory with the config file
  • For stat file, it defaults to the same directory with config file, but user can specify it's location with an option in config file

@fzerorubigd
Copy link
Contributor Author

I think it should be a config directory, not the config file.
and there is no need to another hardcoded path /etc/cow (yes I know it was my first suggestion :) )
if config path provided from command line (i.e -c option) then load it from that directory, ( the default is $HOME/.cow ) and if the config is not available in that folder, exit with error.

the /etc/cow folder is a unix std, and we have alot of windows user :), and if we can provide -c option, then there is no need to use another hard coded path. service files (rc.d or service file for systemd or anything else) could use the -c option

@fzerorubigd
Copy link
Contributor Author

@cyfdecyf
And about the stat file, I couldn't agree more.

@cyfdecyf
Copy link
Owner

I took a look at nginx and dnsmasq's options. For nginx you can specify config file, while for dnsmasq you can either set config file or config directory.

I'd prefer to specify the config file, as only this file is mandatory for running cow. This also allows users to specify different config files in the same directory. (I do this when debugging cow.)

I agree with you for removing /etc/cow path. So

  • for Unix, let's default to $HOME/.cow/rc
  • for Windows, let's default to ./rc

For stat, let's add an option in config file.

Hope my company work goes smooth so I can finish this feature this week.

@fzerorubigd
Copy link
Contributor Author

@cyfdecyf starting work on stat file position ....

cyfdecyf added a commit that referenced this issue Jun 2, 2015
Also load stat/blocked/direct default from directory containing config file.
Laisky pushed a commit to Laisky/cow that referenced this issue Oct 25, 2022
Laisky pushed a commit to Laisky/cow that referenced this issue Oct 25, 2022
…file.

Also load stat/blocked/direct default from directory containing config file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants