forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.go
41 lines (36 loc) · 951 Bytes
/
settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package settings
import (
"github.com/argoproj/argo-cd/util/settings"
"github.com/ghodss/yaml"
"golang.org/x/net/context"
)
// Server provides a Settings service
type Server struct {
mgr *settings.SettingsManager
}
// NewServer returns a new instance of the Repository service
func NewServer(mgr *settings.SettingsManager) *Server {
return &Server{
mgr: mgr,
}
}
// Get returns ArgoCD settings
func (s *Server) Get(ctx context.Context, q *SettingsQuery) (*Settings, error) {
argoCDSettings, err := s.mgr.GetSettings()
if err != nil {
return nil, err
}
set := Settings{
URL: argoCDSettings.URL,
}
var cfg DexConfig
err = yaml.Unmarshal([]byte(argoCDSettings.DexConfig), &cfg)
if err == nil {
set.DexConfig = &cfg
}
return &set, nil
}
// AuthFuncOverride disables authentication for settings service
func (s *Server) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) {
return ctx, nil
}