Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
oanatmaria committed Sep 25, 2023
1 parent b5f86e4 commit f32dde2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ linters-settings:
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 18
min-complexity: 20
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
Expand Down
22 changes: 11 additions & 11 deletions pkg/app/ui/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ func UIHandler(consoleFS http.FileSystem) http.Handler {
func ConfigHandler(confServices *config.Config) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
type consoleCfg struct {
AsertoDirectoryUrl string `json:"asertoDirectoryUrl"`
AuthorizerServiceUrl string `json:"authorizerServiceUrl"`
AuthorizerApiKey string `json:"authorizerApiKey"`
DirectoryApiKey string `json:"directoryApiKey"`
DirectoryTenantId string `json:"directoryTenantId"`
AsertoDirectoryURL string `json:"asertoDirectoryUrl"`
AuthorizerServiceURL string `json:"authorizerServiceUrl"`
AuthorizerAPIKey string `json:"authorizerApiKey"`
DirectoryAPIKey string `json:"directoryApiKey"`
DirectoryTenantID string `json:"directoryTenantId"`
}

var apiKey string
Expand All @@ -45,22 +45,22 @@ func ConfigHandler(confServices *config.Config) func(w http.ResponseWriter, r *h

cfg := &consoleCfg{}
if serviceConfig, ok := confServices.Services["authorizer"]; ok {
cfg.AuthorizerServiceUrl = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress)
cfg.AuthorizerApiKey = apiKey
cfg.AuthorizerServiceURL = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress)
cfg.AuthorizerAPIKey = apiKey
}

if serviceConfig, ok := confServices.Services["reader"]; ok {
cfg.AsertoDirectoryUrl = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress)
cfg.AsertoDirectoryURL = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress)
} else {
host := strings.Split(confServices.DirectoryResolver.Address, ":")[0]
cfg.AsertoDirectoryUrl = fmt.Sprintf("https://%s", host)
cfg.AsertoDirectoryURL = fmt.Sprintf("https://%s", host)
if confServices.DirectoryResolver.TenantID != "" {
cfg.DirectoryTenantId = confServices.DirectoryResolver.TenantID
cfg.DirectoryTenantID = confServices.DirectoryResolver.TenantID
}
}

if confServices.DirectoryResolver.APIKey != "" {
cfg.DirectoryApiKey = confServices.DirectoryResolver.APIKey
cfg.DirectoryAPIKey = confServices.DirectoryResolver.APIKey
}

buf, _ := json.Marshal(cfg)
Expand Down
16 changes: 0 additions & 16 deletions pkg/cli/cmd/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ func (cmd *GetManifestCmd) Run(c *cc.CommonCtx) error {
return err
}

// if !cmd.Stdout && cmd.Path == "" {
// currentDir, err := os.Getwd()
// if err != nil {
// return err
// }
// cmd.Path = path.Join(currentDir, defaultManifestName)
// }

color.Green(">>> get manifest to %s", cmd.Path)

r, err := dirClient.GetManifest(c.Context)
Expand Down Expand Up @@ -91,14 +83,6 @@ func (cmd *SetManifestCmd) Run(c *cc.CommonCtx) error {
}
}

// if cmd.Path == defaultManifestName {
// currentDir, err := os.Getwd()
// if err != nil {
// return err
// }
// cmd.Path = path.Join(currentDir, defaultManifestName)
// }

color.Green(">>> set manifest from %s", cmd.Path)

return dirClient.SetManifest(c.Context, r)
Expand Down

0 comments on commit f32dde2

Please sign in to comment.