Closed franchb closed 2 weeks ago
hey!
you should be able to:
- src: {{.Paths.EnvFile}}
dst: /etc/default/{{.Name}} # for DEB-based
type: config|noreplace
packager: deb
- src: {{.Paths.EnvFile}}
dst: /etc/sysconfig/{{.Name}} # for RPM-based
type: config|noreplace
packager: rpm
that would allow the to have the file in different places for each platform.
does that solve your issue?
Thank you, @caarlos0 ! Yes, this solved my issue.
Is your feature request related to a problem? Please describe.
In both Debian and RPM-based systems, the directories
/etc/default
and/etc/sysconfig
are used to store configuration files for system services, but there are some differences in their usage and conventions:Debian (
/etc/default
)/etc/default
directory./etc/init.d
or/lib/systemd/system
.cron
on a Debian-based system might be/etc/default/cron
.RPM-Based (
/etc/sysconfig
)/etc/sysconfig
directory./etc/default
, containing environment variables for service startup scripts located in/etc/init.d
or systemd unit files./etc/sysconfig/network
.Key Points:
/etc/default
is standard for Debian-based distributions,/etc/sysconfig
is the norm for RPM-based distributions.Example Configuration Snippet:
Debian (
/etc/default/nginx
):RPM-Based (
/etc/sysconfig/nginx
):Both approaches allow system administrators to control service behaviors without modifying the main startup scripts, promoting modular and maintainable configurations.
Describe the solution you'd like
A method to provide environment variables to a service in a generic way for both Debian and RPM-based distributions.
Describe alternatives you've considered
Copy
.env
file to both locationsSearch
Code of Conduct
Additional context
No response