Skip to content

Commit

Permalink
chore: cleanup setup
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Sep 5, 2024
1 parent ccc899a commit 105f20a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 46 deletions.
5 changes: 0 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ GITHUB_SECRET=
SERVICE_LENS_ADDR=
POSTGRES_URL=
SERVICE_LENS_DATABASE_TABLE_PREFIX=
SERVICE_LENS_FGA_API_URL=
SERVICE_LENS_FGA_STORE_ID=
SERVICE_LENS_FGA_AUTHORIZATION_MODEL_ID=
SERVICE_LENS_OIDC_ISSUER=
SERVICE_LENS_OIDC_AUDIENCE=
SERVICE_LENS_GITHUB_CALLBACK_URL=
SERVICE_LENS_GITHUB_CLIENT_SECRET=
SERVICE_LENS_GITHUB_CLIENT_ID=
5 changes: 0 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ func init() {
Root.PersistentFlags().StringVar(&config.Flags.Environment, "environment", config.Flags.Environment, "environment")
Root.PersistentFlags().StringVar(&config.Flags.DatabaseURI, "db-rul", config.Flags.DatabaseURI, "Database URI")
Root.PersistentFlags().StringVar(&config.Flags.DatabaseTablePrefix, "db-table-prefix", config.Flags.DatabaseTablePrefix, "Database table prefix")
Root.PersistentFlags().StringVar(&config.Flags.FGAApiUrl, "fga-api-url", config.Flags.FGAApiUrl, "FGA API URL")
Root.PersistentFlags().StringVar(&config.Flags.FGAStoreID, "fga-store-id", config.Flags.FGAStoreID, "FGA Store ID")
Root.PersistentFlags().StringVar(&config.Flags.FGAAuthorizationModelID, "fga-authorization-model-id", config.Flags.FGAAuthorizationModelID, "FGA Authorization Model ID")
Root.PersistentFlags().StringVar(&config.Flags.OIDCIssuer, "oidc-issuer", config.Flags.OIDCIssuer, "OIDC Issuer")
Root.PersistentFlags().StringVar(&config.Flags.OIDCAudience, "oidc-audience", config.Flags.OIDCAudience, "OIDC Audience")

Root.SilenceUsage = true
}
Expand Down
19 changes: 2 additions & 17 deletions helm/charts/service-lens/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ spec:

env:
{{- if .Values.database.uri }}
- name: SERVICE_LENS_DATABASE_URI
- name: POSTGRES_URL
value: "{{ .Values.database.uri }}"
{{- else if .Values.database.uriSecret }}
- name: SERVICE_LENS_DATABASE_URI
- name: POSTGRES_URL
valueFrom:
secretKeyRef:
name: "{{ .Values.database.uriSecret }}"
Expand All @@ -82,21 +82,6 @@ spec:
value: "{{ .Values.http.addr }}"
{{- end }}

{{- if .Values.fga.uri }}
- name: TYPHOON_WEB_FGA_API_URL
value: "{{ .Values.fga.uri }}"
{{- end }}

{{- if .Values.fga.storeId }}
- name: TYPHOON_WEB_FGA_STORE_ID
value: "{{ .Values.fga.storeId }}"
{{- end }}

{{- if .Values.fga.authorizationModelId }}
- name: TYPHOON_WEB_FGA_AUTHORIZATION_MODEL_ID
value: "{{ .Values.fga.authorizationModelId }}"
{{- end }}

{{- if .Values.goth.github.clientID }}
- name: SERVICE_LENS_GITHUB_CLIENT_ID
value: "{{ .Values.goth.github.clientID }}"
Expand Down
9 changes: 2 additions & 7 deletions helm/charts/service-lens/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,16 @@ spec:
value: "{{ .Values.database.prefix }}"
{{- end }}
{{- if .Values.database.uri }}
- name: SERVICE_LENS_DATABASE_URI
- name: POSTGRES_URL
value: "{{ .Values.database.uri }}"
{{- else if .Values.database.uriSecret }}
- name: SERVICE_LENS_DATABASE_URI
- name: POSTGRES_URL
valueFrom:
secretKeyRef:
name: "{{ .Values.database.uriSecret }}"
key: "uri"
{{- end }}

{{- if .Values.migrate.timeout }}
- name: SERVICE_LENS_TIMEOUT
value: "{{ .Values.migrate.timeout }}"
{{- end }}

{{- with .Values.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
19 changes: 7 additions & 12 deletions internal/cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ import (

// Flags contains the command line flags.
type Flags struct {
Environment string `envconfig:"SERVICE_LENS_ENV" default:"production"`
Addr string `envconfig:"SERVICE_LENS_ADDR" default:":8084"`
DatabaseURI string `envconfig:"POSTGRES_URL" default:""`
DatabaseTablePrefix string `envconfig:"SERVICE_LENS_DATABASE_TABLE_PREFIX" default:"service_lens_"`
FGAApiUrl string `envconfig:"SERVICE_LENS_FGA_API_URL" default:""`
FGAStoreID string `envconfig:"SERVICE_LENS_FGA_STORE_ID" default:""`
FGAAuthorizationModelID string `envconfig:"SERVICE_LENS_FGA_AUTHORIZATION_MODEL_ID" default:""`
OIDCIssuer string `envconfig:"SERVICE_LENS_OIDC_ISSUER" default:""`
OIDCAudience string `envconfig:"SERVICE_LENS_OIDC_AUDIENCE" default:""`
GitHubCallbackURL string `envconfig:"SERVICE_LENS_GITHUB_CALLBACK_URL" default:""`
GitHubClientID string `envconfig:"SERVICE_LENS_GITHUB_CLIENT_ID" default:""`
GitHubClientSecret string `envconfig:"SERVICE_LENS_GITHUB_CLIENT_SECRET" default:""`
Environment string `envconfig:"SERVICE_LENS_ENV" default:"production"`
Addr string `envconfig:"SERVICE_LENS_ADDR" default:":8084"`
DatabaseURI string `envconfig:"POSTGRES_URL" default:""`
DatabaseTablePrefix string `envconfig:"SERVICE_LENS_DATABASE_TABLE_PREFIX" default:"service_lens_"`
GitHubCallbackURL string `envconfig:"SERVICE_LENS_GITHUB_CALLBACK_URL" default:""`
GitHubClientID string `envconfig:"SERVICE_LENS_GITHUB_CLIENT_ID" default:""`
GitHubClientSecret string `envconfig:"SERVICE_LENS_GITHUB_CLIENT_SECRET" default:""`
}

// NewFlags returns a new instance of Flags.
Expand Down

0 comments on commit 105f20a

Please sign in to comment.