core/zero: add support for managed mode from config file (#4756)

This commit is contained in:
Caleb Doxsey 2023-11-17 09:04:59 -07:00 committed by GitHub
parent eb729a53f8
commit 6810091d38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 9 deletions

View file

@ -17,13 +17,13 @@ import (
)
// Run runs the pomerium zero command.
func Run(ctx context.Context) error {
func Run(ctx context.Context, configFile string) error {
err := setupLogger()
if err != nil {
return fmt.Errorf("error setting up logger: %w", err)
}
token := getToken()
token := getToken(configFile)
if token == "" {
return errors.New("no token provided")
}
@ -37,8 +37,8 @@ func Run(ctx context.Context) error {
}
// IsManagedMode returns true if Pomerium should start in managed mode using this command.
func IsManagedMode() bool {
return getToken() != ""
func IsManagedMode(configFile string) bool {
return getToken(configFile) != ""
}
func withInterrupt(ctx context.Context) context.Context {