diff options
author | Christian Heimes <christian@python.org> | 2015-10-09 16:10:16 +0200 |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2015-10-09 16:10:16 +0200 |
commit | 1394648220cf3c92e498833f97046072379bddce (patch) | |
tree | 2f227247b54a2fca37bb5cef9654f43faca3d545 | |
parent | ece2b876ebeea48e30c9d7007a8480acbcf907f8 (diff) | |
download | gustodia-1394648220cf3c92e498833f97046072379bddce.tar.gz gustodia-1394648220cf3c92e498833f97046072379bddce.tar.xz gustodia-1394648220cf3c92e498833f97046072379bddce.zip |
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | gustodia.go | 21 |
2 files changed, 17 insertions, 6 deletions
@@ -3,7 +3,7 @@ Custodia Docker entrypoint Firt shell ---------- -$ sudo dnf install golang make python-virtualenv openssl-devel python-devel +$ sudo dnf install golang make python-virtualenv openssl-devel python-devel git libffi-devel $ make run_server Second shell diff --git a/gustodia.go b/gustodia.go index c2316c4..8a5b0de 100644 --- a/gustodia.go +++ b/gustodia.go @@ -108,15 +108,17 @@ type CustodiaClient struct { BasePath string Prefix string SecretPrefix string + RemoteUser string Secrets []*CustodiaSecret } -func NewCustodiaClient(socketpath string) *CustodiaClient { +func NewCustodiaClient(socketpath, remoteuser string) *CustodiaClient { return &CustodiaClient{ SocketPath: socketpath, BasePath: BASE_PATH, Prefix: PREFIX, SecretPrefix: SECRET_PREFIX, + RemoteUser: remoteuser, Secrets: []*CustodiaSecret{}, } } @@ -149,7 +151,9 @@ func (cc *CustodiaClient) QueryCustodia() { if err != nil { panic(err) } - req.Header.Add("REMOTE_USER", "gustodia") + if cc.RemoteUser != "" { + req.Header.Add("REMOTE_USER", cc.RemoteUser) + } resp, err := client.Do(req) if err != nil { log.Fatal(err) @@ -204,6 +208,8 @@ func (cc CustodiaClient) Debug() { } func main() { + debug := os.Getenv("CUSTODIA_DEBUG") != "" + if len(os.Args) < 2 { log.Fatalf("%s entrypoint [args]", os.Args[0]) } @@ -213,13 +219,18 @@ func main() { // default socket is in the same directory as program socketpath = path.Join(path.Dir(os.Args[0]), "server_socket") } + remoteuser := os.Getenv("CUSTODIA_REMOTE_USER") - client := NewCustodiaClient(socketpath) + client := NewCustodiaClient(socketpath, remoteuser) + if debug { + fmt.Printf("%+v\n", client) + } client.FindEnvs() client.QueryCustodia() - //client.Debug() environ := client.MakeEnv() - + if debug { + client.Debug() + } args := os.Args[1:] syscall.Exec(args[0], args, environ) |