Skip to content

Commit

Permalink
fix: config file path
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Sep 20, 2022
1 parent 623c2e3 commit 2a164be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,20 @@ var serveCmd = &cobra.Command{
if signingKey == "" {
return errors.New("signing key must be defined")
}

block, _ := pem.Decode([]byte(signingKey))
if block == nil {
return errors.New("invalid signing key, cannot parse as PEM")
}

key, err := x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {
return err
}

viper.SetConfigName(viper.GetString(configFlag))
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
sharedlogging.GetLogger(cmd.Context()).Infof("no viper config file found")
} else {
if viper.GetString(configFlag) != "" {
viper.SetConfigFile(viper.GetString(configFlag))
if err := viper.ReadInConfig(); err != nil {
return errors.Wrap(err, "reading viper config file")
}
}
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
- serve
environment:
DEBUG: 1
CONFIG: ./config.yaml
POSTGRES_URI: "host=postgres user=auth password=auth dbname=auth port=5432 sslmode=disable"
CAOS_OIDC_DEV: 1
OTEL_TRACES: true
Expand Down

0 comments on commit 2a164be

Please sign in to comment.