auth
2015-06-29
Parent:8267e1c8bcd1
auth/postgres.go
Create Docker image for authd. Create a Dockerfile for authd, which will wrap the compiled Go binary up into a tiny little Docker image. Create an authd/build-docker.sh script that will build the statically-linked binary in a Docker container, so the authd Docker image can use it. We had to include ca-certificates.crt in the Dockerfile, as well, so we could communicate over SSL with things. A wrapper.sh file is included that will pull the JWT_SECRET environment variable out of a kubernetes secrets file, which is a handy wrapper to have. Finally, we added the authd/docker-authd binary to the .hgignore.
| paddy@148 | 1 package auth |
| paddy@148 | 2 |
| paddy@148 | 3 import ( |
| paddy@148 | 4 "database/sql" |
| paddy@149 | 5 ) |
| paddy@148 | 6 |
| paddy@149 | 7 func NewPostgres(conn string) (postgres, error) { |
| paddy@149 | 8 db, err := sql.Open("postgres", conn) |
| paddy@149 | 9 if err != nil { |
| paddy@149 | 10 return postgres{}, err |
| paddy@149 | 11 } |
| paddy@149 | 12 return postgres{db: db}, nil |
| paddy@149 | 13 } |
| paddy@148 | 14 |
| paddy@148 | 15 type postgres struct { |
| paddy@148 | 16 db *sql.DB |
| paddy@148 | 17 } |