client_secret_cmd
This commit is contained in:
parent
2a0b47f7cd
commit
7d45a3dd4c
10
cmd/root.go
10
cmd/root.go
@ -4,7 +4,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gospt/internal/auth"
|
||||
"gospt/internal/config"
|
||||
@ -84,4 +86,12 @@ func initConfig() {
|
||||
if err := loader.Load(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if config.Values.ClientSecretCmd != "" {
|
||||
args := strings.Fields(config.Values.ClientSecretCmd)
|
||||
secret, err := exec.Command(args[0], args[1:]...).Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
config.Values.ClientSecret = strings.TrimSpace(string(secret))
|
||||
}
|
||||
}
|
||||
|
@ -3,4 +3,5 @@ package config
|
||||
var Values struct {
|
||||
ClientId string `yaml:"client_id"`
|
||||
ClientSecret string `yaml:"client_secret"`
|
||||
ClientSecretCmd string `yaml:"client_secret_cmd"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user