secrets as environment variables. closes #5
This commit is contained in:
parent
e3002667fc
commit
7dc5b691e7
@ -96,7 +96,9 @@ The command line to run `google_auth_proxy` would look like this:
|
||||
--client-secret=...
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
||||
The environment variables `google_auth_client_id`, `google_auth_secret` and `google_auth_cookie_secret` can be used in place of the corresponding command-line arguments.
|
||||
|
||||
## Endpoint Documentation
|
||||
|
||||
|
13
main.go
13
main.go
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@ -32,8 +33,20 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// Try to use env for secrets if no flag is set
|
||||
if *clientID == "" {
|
||||
*clientID = os.Getenv("google_auth_client_id")
|
||||
}
|
||||
if *clientSecret == "" {
|
||||
*clientSecret = os.Getenv("google_auth_secret")
|
||||
}
|
||||
if *cookieSecret == "" {
|
||||
*cookieSecret = os.Getenv("google_auth_cookie_secret")
|
||||
}
|
||||
|
||||
if *showVersion {
|
||||
fmt.Printf("google_auth_proxy v%s\n", VERSION)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user