commit 82880ac92499148484ea31b626a43e4e6a21e642
parent 6f713538a12534808712c27f64d54597d680e5c2
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Wed, 27 Sep 2023 12:58:59 +0200
fix(config): hivedav env var prefix
Diffstat:
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/config/config.go b/config/config.go
@@ -58,8 +58,8 @@ func (c *Config) LoadConfig(path string) (*Config, error) {
viper.AutomaticEnv()
// override config file vars with vars from environment
- if viper.IsSet("HIVEDAV_HOST") {
- c.HiveDavHost = viper.GetString("HIVEDAV_HOST")
+ if viper.IsSet("HOST") {
+ c.HiveDavHost = viper.GetString("HOST")
}
if viper.IsSet("LISTEN_ADDRESS") {
c.ListenAddress = viper.GetString("LISTEN_ADDRESS")
@@ -67,9 +67,6 @@ func (c *Config) LoadConfig(path string) (*Config, error) {
if viper.IsSet("LISTEN_PORT") {
c.ListenPort = viper.GetInt("LISTEN_PORT")
}
- if viper.IsSet("HOST") {
- c.CaldavUri = viper.GetString("HOST")
- }
if viper.IsSet("CALDAV_URI") {
c.CaldavUri = viper.GetString("CALDAV_URI")
}
@@ -85,26 +82,26 @@ func (c *Config) LoadConfig(path string) (*Config, error) {
if viper.IsSet("REFRESH_INTERVAL") {
c.RefreshInterval = viper.GetInt("REFRESH_INTERVAL")
}
- if viper.IsSet("HIVEDAV_SMTP_HOST") {
- c.SmtpHost = viper.GetString("HIVEDAV_SMTP_HOST")
+ if viper.IsSet("SMTP_HOST") {
+ c.SmtpHost = viper.GetString("SMTP_HOST")
}
- if viper.IsSet("HIVEDAV_SMTP_PORT") {
- c.SmtpPort = viper.GetInt("HIVEDAV_SMTP_PORT")
+ if viper.IsSet("SMTP_PORT") {
+ c.SmtpPort = viper.GetInt("SMTP_PORT")
}
- if viper.IsSet("HIVEDAV_SMTP_USER") {
- c.SmtpUser = viper.GetString("HIVEDAV_SMTP_USER")
+ if viper.IsSet("SMTP_USER") {
+ c.SmtpUser = viper.GetString("SMTP_USER")
}
- if viper.IsSet("HIVEDAV_SMTP_PASSWORD") {
- c.SmtpPassword = viper.GetString("HIVEDAV_SMTP_PASSWORD")
+ if viper.IsSet("SMTP_PASSWORD") {
+ c.SmtpPassword = viper.GetString("SMTP_PASSWORD")
}
- if viper.IsSet("HIVEDAV_BOOKING_SUMMARY") {
- c.BookingSummary = viper.GetString("HIVEDAV_BOOKING_SUMMARY")
+ if viper.IsSet("BOOKING_SUMMARY") {
+ c.BookingSummary = viper.GetString("BOOKING_SUMMARY")
}
- if viper.IsSet("HIVEDAV_BOOKING_LOCATION") {
- c.BookingLocation = viper.GetString("HIVEDAV_BOOKING_LOCATION")
+ if viper.IsSet("BOOKING_LOCATION") {
+ c.BookingLocation = viper.GetString("BOOKING_LOCATION")
}
- if viper.IsSet("HIVEDAV_BOOKING_REMINDER") {
- c.BookingReminder = viper.GetInt("HIVEDAV_BOOKING_REMINDER")
+ if viper.IsSet("BOOKING_REMINDER") {
+ c.BookingReminder = viper.GetInt("BOOKING_REMINDER")
}
return c, nil