Skip to content

Commit

Permalink
Move token into cloud config
Browse files Browse the repository at this point in the history
  • Loading branch information
andscoop committed May 9, 2018
1 parent ff5f9ac commit 0f2ce51
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Login() {
return
}

config.CFG.UserAPIAuthToken.SetProjectString(token.Token)
config.CFG.CloudAPIToken.SetProjectString(token.Token)

//authenticate with registry
dockerErr := docker.ExecLogin(registry, username, password)
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ var (
CFG = cfgs{
CloudDomain: newCfg("cloud.domain", true, ""),
CloudAPIProtocol: newCfg("cloud.api.protocol", true, "https"),
CloudAPIPort: newCfg("cloud.api.port", true, "443"),
CloudAPIPort: newCfg("cloud.api.port", true, "443"),
CloudAPIToken: newCfg("cloud.api.token", true, ""),
PostgresUser: newCfg("postgres.user", true, "postgres"),
PostgresPassword: newCfg("postgres.password", true, "postgres"),
PostgresHost: newCfg("postgres.host", true, "postgres"),
PostgresPort: newCfg("postgres.port", true, "5432"),
RegistryAuthority: newCfg("docker.registry.authority", true, ""),
RegistryAuth: newCfg("docker.registry.auth", true, ""),
ProjectName: newCfg("project.name", true, ""),
UserAPIAuthToken: newCfg("user.apiAuthToken", true, ""),
}

// viperHome is the viper object in the users home directory
Expand Down
4 changes: 2 additions & 2 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ type cfg struct {

// cfgs houses all configurations for an astro project
type cfgs struct {
CloudDomain cfg
CloudDomain cfg
CloudAPIProtocol cfg
CloudAPIPort cfg
CloudAPIToken cfg
PostgresUser cfg
PostgresPassword cfg
PostgresHost cfg
PostgresPort cfg
RegistryAuthority cfg
RegistryAuth cfg
ProjectName cfg
UserAPIAuthToken cfg
}

// Creates a new cfg struct
Expand Down
4 changes: 2 additions & 2 deletions houston/houston.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func (c *Client) QueryHouston(query string) (*HoustonResponse, error) {
}

// set headers
if config.CFG.UserAPIAuthToken.GetString() != "" {
doOpts.Headers["authorization"] = config.CFG.UserAPIAuthToken.GetString()
if config.CFG.CloudAPIToken.GetString() != "" {
doOpts.Headers["authorization"] = config.CFG.CloudAPIToken.GetString()
}

// if config.GetString(config.OrgIDCFG) != "" {
Expand Down

0 comments on commit 0f2ce51

Please sign in to comment.