added oauth flow to get authorization code
This commit is contained in:
23
pkg/oauth/config.go
Normal file
23
pkg/oauth/config.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package oauth
|
||||
|
||||
import (
|
||||
"git.haelnorr.com/h/golib/env"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
PrivateKey string // ENV OAUTH_PRIVATE_KEY: Private key for signing OAuth state tokens (required)
|
||||
}
|
||||
|
||||
func ConfigFromEnv() (any, error) {
|
||||
cfg := &Config{
|
||||
PrivateKey: env.String("OAUTH_PRIVATE_KEY", ""),
|
||||
}
|
||||
|
||||
// Check required fields
|
||||
if cfg.PrivateKey == "" {
|
||||
return nil, errors.New("Envar not set: OAUTH_PRIVATE_KEY")
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
Reference in New Issue
Block a user