mirror of
https://github.com/h44z/wg-portal
synced 2025-02-26 05:49:14 +00:00
feat: handle missing config file gracefully with a warning (#331)
Signed-off-by: Dmytro Bondar <git@bonddim.com>
This commit is contained in:
parent
983568b36a
commit
0ea24e313d
@ -159,6 +159,10 @@ func GetConfig() (*Config, error) {
|
||||
func loadConfigFile(cfg any, filename string) error {
|
||||
data, err := envsubst.ReadFile(filename)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
logrus.Warnf("Config file %s not found, using default values", filename)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("envsubst error: %v", err)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user