@@ -96,6 +96,8 @@ type Config struct {
9696 Database string `toml:"database"`
9797 Username string `toml:"username"`
9898 Password string `toml:"-"`
99+ WebPassword string `toml:"-"`
100+ TOTPSecret string `toml:"-"`
99101 OPSecrets * OPSecrets `toml:"op_secrets"`
100102 Models map [string ]ModelConfig `toml:"models"`
101103 Hours HoursLimits `toml:"hours"`
@@ -104,22 +106,25 @@ type Config struct {
104106 CompanyColors map [string ]string `toml:"company_colors"` // company name → lipgloss color string
105107}
106108
107- func (c * Config ) OdooURL () string { return c .URL }
108- func (c * Config ) OdooDatabase () string { return c .Database }
109- func (c * Config ) OdooUsername () string { return c .Username }
110- func (c * Config ) OdooPassword () string { return c .Password }
109+ func (c * Config ) OdooURL () string { return c .URL }
110+ func (c * Config ) OdooDatabase () string { return c .Database }
111+ func (c * Config ) OdooUsername () string { return c .Username }
112+ func (c * Config ) OdooPassword () string { return c .Password }
113+ func (c * Config ) OdooWebPassword () string { return c .WebPassword }
111114
112115// LoadFromEnv reads configuration from environment variables.
113116// It reads whatever env vars are set without requiring any.
114117// Use Validate to check that all required fields are present.
115118func LoadFromEnv () * Config {
116119 return & Config {
117- URL : os .Getenv ("ODOO_URL" ),
118- Database : os .Getenv ("ODOO_DATABASE" ),
119- Username : os .Getenv ("ODOO_USERNAME" ),
120- Password : os .Getenv ("ODOO_PASSWORD" ),
121- Hours : DefaultHoursLimits (),
122- Bundesland : DefaultBundesland ,
120+ URL : os .Getenv ("ODOO_URL" ),
121+ Database : os .Getenv ("ODOO_DATABASE" ),
122+ Username : os .Getenv ("ODOO_USERNAME" ),
123+ Password : os .Getenv ("ODOO_PASSWORD" ),
124+ WebPassword : os .Getenv ("ODOO_WEB_PASSWORD" ),
125+ TOTPSecret : os .Getenv ("ODOO_TOTP_SECRET" ),
126+ Hours : DefaultHoursLimits (),
127+ Bundesland : DefaultBundesland ,
123128 }
124129}
125130
@@ -197,6 +202,12 @@ func (c *Config) Merge(other *Config) {
197202 if other .Password != "" {
198203 c .Password = other .Password
199204 }
205+ if other .WebPassword != "" {
206+ c .WebPassword = other .WebPassword
207+ }
208+ if other .TOTPSecret != "" {
209+ c .TOTPSecret = other .TOTPSecret
210+ }
200211 if other .Bundesland != "" {
201212 c .Bundesland = other .Bundesland
202213 }
@@ -213,9 +224,15 @@ func (c *Config) Merge(other *Config) {
213224 if other .OPSecrets .Username != "" {
214225 c .OPSecrets .Username = other .OPSecrets .Username
215226 }
227+ if other .OPSecrets .APIKey != "" {
228+ c .OPSecrets .APIKey = other .OPSecrets .APIKey
229+ }
216230 if other .OPSecrets .Password != "" {
217231 c .OPSecrets .Password = other .OPSecrets .Password
218232 }
233+ if other .OPSecrets .TOTPSecret != "" {
234+ c .OPSecrets .TOTPSecret = other .OPSecrets .TOTPSecret
235+ }
219236 }
220237 if other .Hours .DailyLow != 0 {
221238 c .Hours .DailyLow = other .Hours .DailyLow
0 commit comments