allow secrets via env variables
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
17
main.go
17
main.go
@@ -408,6 +408,23 @@ func main() {
|
|||||||
panic("Unable to connect to empty vCenter URL")
|
panic("Unable to connect to empty vCenter URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Look for credentials from environment variables
|
||||||
|
val, present := os.LookupEnv("VCENTER_USER")
|
||||||
|
if present {
|
||||||
|
fmt.Println("Loaded vcenter user from environment variable")
|
||||||
|
*vUser = val
|
||||||
|
}
|
||||||
|
val, present = os.LookupEnv("VCENTER_PASS")
|
||||||
|
if present {
|
||||||
|
fmt.Println("Loaded vcenter password from environment variable")
|
||||||
|
*vPass = val
|
||||||
|
}
|
||||||
|
val, present = os.LookupEnv("CONFLUENCE_TOKEN")
|
||||||
|
if present {
|
||||||
|
fmt.Println("Loaded confluence Personal Access Token from environment variable")
|
||||||
|
*cToken = val
|
||||||
|
}
|
||||||
|
|
||||||
// Print logs to file
|
// Print logs to file
|
||||||
f, err := os.OpenFile("log.txt", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
f, err := os.OpenFile("log.txt", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user