Skip to content

Commit

Permalink
More auth tweaks. (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-rieke committed Jan 27, 2024
1 parent 928c878 commit 9d3634f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions atrium/vestibulum/trcshbase/trcsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,16 @@ func ProcessDeploy(featherCtx *cap.FeatherContext, config *eUtils.DriverConfig,
config.Log.Printf("Auth..")

trcshEnvRaw := config.EnvRaw
var auth string
authTokenName := "vault_token_azuredeploy"
auth := new(string)
authTokenEnv := "azuredeploy"
autoErr := eUtils.AutoAuth(config, secretId, approleId, &auth, &authTokenName, &authTokenEnv, &config.VaultAddress, &trcshEnvRaw, "deployauth", false)
if autoErr != nil || auth == "" {
appRoleConfig := "deployauth"
if gAgentConfig != nil && gAgentConfig.AgentToken != nil {
auth = gAgentConfig.AgentToken
appRoleConfig = "none"
}
authTokenName := "vault_token_azuredeploy"
autoErr := eUtils.AutoAuth(config, secretId, approleId, auth, &authTokenName, &authTokenEnv, &config.VaultAddress, &trcshEnvRaw, appRoleConfig, false)
if autoErr != nil || *auth == "" {
fmt.Println("Unable to auth.")
fmt.Println(autoErr)
os.Exit(-1)
Expand All @@ -698,9 +703,9 @@ func ProcessDeploy(featherCtx *cap.FeatherContext, config *eUtils.DriverConfig,
if (approleId != nil && len(*approleId) == 0) || (secretId != nil && len(*secretId) == 0) {
// If in context of trcsh, utilize CToken to auth...
if gTrcshConfig != nil && gTrcshConfig.CToken != nil {
auth = *gTrcshConfig.CToken
auth = gTrcshConfig.CToken
} else if gAgentConfig.AgentToken != nil {
auth = *gAgentConfig.AgentToken
auth = gAgentConfig.AgentToken
}
}

Expand Down

0 comments on commit 9d3634f

Please sign in to comment.