auth

Paddy 2015-06-29 Parent:8267e1c8bcd1

175:aa14e29b666f Go to Latest

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.

History
1 package auth
3 import (
4 "database/sql"
5 )
7 func NewPostgres(conn string) (postgres, error) {
8 db, err := sql.Open("postgres", conn)
9 if err != nil {
10 return postgres{}, err
11 }
12 return postgres{db: db}, nil
13 }
15 type postgres struct {
16 db *sql.DB
17 }