auth
2015-06-29
Parent:8267e1c8bcd1
auth/postgres.go
Use an environment variable to set the JWT secret. When setting up the authd server, populate the JWT secret using a JWT_SECRET environment variable. Incidentally, we also included the subscriptions scope, for testing purposes while creating code.secondbit.org/ducky/subscriptions. We now also log the port we're listening on, listen on all interfaces (instead of just 127.0.0.1), and changed the port to 9000 instead of 8080.
| 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 } |