secrets as environment variables. closes #5

This commit is contained in:
Kevin Lamontagne 2013-07-30 17:31:59 -04:00 committed by Jehiah Czebotar
parent e3002667fc
commit 7dc5b691e7
2 changed files with 15 additions and 0 deletions

View File

@ -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
View File

@ -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