From 11ddec34bc83a108b8692fd798ac6b51fe978d87 Mon Sep 17 00:00:00 2001 From: Jake Schuurmans Date: Mon, 14 Oct 2024 17:26:24 -0400 Subject: [PATCH] FS-1723; Fix config struct pointer issue --- chart/templates/cronjob.yaml | 6 ++---- internal/app/config.go | 6 +++--- internal/client/clients.go | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/chart/templates/cronjob.yaml b/chart/templates/cronjob.yaml index c0a4c1d..39de8d6 100644 --- a/chart/templates/cronjob.yaml +++ b/chart/templates/cronjob.yaml @@ -85,17 +85,15 @@ spec: mountPath: /etc/fleet-scheduler readOnly: true env: - - name: FLEET_SCHEDULER_CONFIG - value: "/etc/fleet-scheduler/config.yaml" {{- if $.Values.env.endpoints.fleetdb.authenticate }} - - name: FLEET_SCHEDULER_FLEETDB_OIDC_CLIENT_SECRET + - name: ENDPOINTS_FLEETDB_OIDC_CLIENT_SECRET valueFrom: secretKeyRef: name: fleet-scheduler-secrets key: fleetdb-oidc-client-secret {{- end }} {{- if $.Values.env.endpoints.conditionorc.authenticate }} - - name: FLEET_SCHEDULER_CONDITIONORC_OIDC_CLIENT_SECRET + - name: ENDPOINTS_CONDITIONORC_OIDC_CLIENT_SECRET valueFrom: secretKeyRef: name: fleet-scheduler-secrets diff --git a/internal/app/config.go b/internal/app/config.go index cd6aff0..7a604cb 100644 --- a/internal/app/config.go +++ b/internal/app/config.go @@ -19,7 +19,7 @@ const ( // Values are then grabbed from the ENV variables, anything found will be used to override values in the config file. // Example: Setting Configuration.Endpoints.FleetDB.URL // In the config file (as yaml); endpoints.fleetdb.url: http://fleetdb:8000 -// As a ENV variable; FLIPFLOP_ENDPOINTS_FLEETDB_URL=http://fleetdb:8000 +// As a ENV variable; ENDPOINTS_FLEETDB_URL=http://fleetdb:8000 type Configuration struct { // FacilityCode limits this flipflop to events in a facility. FacilityCode string `mapstructure:"facility"` @@ -34,10 +34,10 @@ type Configuration struct { type Endpoints struct { // FleetDBConfig defines the fleetdb client configuration parameters - ConditionOrc *ConfigOIDC `mapstructure:"conditionorc"` + ConditionOrc ConfigOIDC `mapstructure:"conditionorc"` // FleetDBConfig defines the fleetdb client configuration parameters - FleetDB *ConfigOIDC `mapstructure:"fleetdb"` + FleetDB ConfigOIDC `mapstructure:"fleetdb"` } type ConfigOIDC struct { diff --git a/internal/client/clients.go b/internal/client/clients.go index 18a161a..3e8233d 100644 --- a/internal/client/clients.go +++ b/internal/client/clients.go @@ -58,7 +58,7 @@ func (c *Client) newFleetDBClient() error { var secret string if c.cfg.Endpoints.FleetDB.Authenticate { secret = c.cfg.Endpoints.FleetDB.OidcClientSecret - client, err = c.setUpClientWithOAuth(c.cfg.Endpoints.FleetDB) + client, err = c.setUpClientWithOAuth(&c.cfg.Endpoints.FleetDB) if err != nil { return err } @@ -89,7 +89,7 @@ func (c *Client) newConditionOrcClient() error { var secret string if c.cfg.Endpoints.ConditionOrc.Authenticate { secret = c.cfg.Endpoints.ConditionOrc.OidcClientSecret - client, err = c.setUpClientWithOAuth(c.cfg.Endpoints.ConditionOrc) + client, err = c.setUpClientWithOAuth(&c.cfg.Endpoints.ConditionOrc) if err != nil { return err }