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=...
|
--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
|
## Endpoint Documentation
|
||||||
|
|
||||||
|
13
main.go
13
main.go
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
@ -32,8 +33,20 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
flag.Parse()
|
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 {
|
if *showVersion {
|
||||||
fmt.Printf("google_auth_proxy v%s\n", VERSION)
|
fmt.Printf("google_auth_proxy v%s\n", VERSION)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user