Skip to content

Commit

Permalink
Providing Kong admin token via file Kong#4789
Browse files Browse the repository at this point in the history
Feedback from PR review.
  • Loading branch information
ludovic-pourrat committed Oct 11, 2023
1 parent 82311e1 commit 5aff8cd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions internal/manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,14 @@ func (c *Config) FlagSet() *pflag.FlagSet {
return flagSet
}

// Resolve the Config item(s) value from file, when provided.
func (c *Config) Resolve() error {
if c.KongAdminToken == "" {
if c.KongAdminTokenPath != "" {
token, err := os.ReadFile(c.KongAdminTokenPath)
if err != nil {
return fmt.Errorf("failed to read --kong-admin-token-file from path '%s': %w", c.KongAdminTokenPath, err)
}
c.KongAdminToken = string(token)
if c.KongAdminTokenPath != "" {
token, err := os.ReadFile(c.KongAdminTokenPath)
if err != nil {
return fmt.Errorf("failed to read --kong-admin-token-file from path '%s': %w", c.KongAdminTokenPath, err)
}
c.KongAdminToken = string(token)
}
return nil
}
Expand Down

0 comments on commit 5aff8cd

Please sign in to comment.