Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { Server *Server `environment:"SERVER"` Storage *Storage `environment:"STORAGE"` Hash *Hash `environment:"HASH"` JwtPrivateKeyPath string `environment:"JWT_PRIVATE_KEY_PATH"` }
Configuration stores all the application config.
func Defaults ¶
func Defaults() Configuration
Defaults returns a Configuration with all the default options. This ignores environment variable values.
func MustParse ¶
func MustParse() Configuration
MustParse wraps Parse, but prints the errors and exits rather than returning them.
func Parse ¶
func Parse() (Configuration, error)
Parse loads the app config using Viper. It logs all the values before returning, and panics on validation errors.
func (*Configuration) JwtPrivateKey ¶
func (cfg *Configuration) JwtPrivateKey() (*ecdsa.PrivateKey, error)
JwtPrivateKey returns the PrivateKey object from the file at the given path. This can be used to sign JWTs in the app.
type Hash ¶
type Hash struct { Time uint32 `environment:"ITERATIONS"` Memory uint32 `environment:"MEMORY_BYTES"` Parallelism uint8 `environment:"PARALLELISM"` SaltLength uint8 `environment:"SALT_LENGTH"` KeyLength uint32 `environment:"KEY_LENGTH"` }
Hash configures the hashing algorithm used to store passwords. This project hashes with Argon2: https://www.alexedwards.net/blog/how-to-hash-and-verify-passwords-with-argon2-in-go
type Postgres ¶
type Postgres struct { Database string `environment:"DBNAME"` Host string `environment:"HOST"` Port int `environment:"PORT"` User string `environment:"USER"` Password string `environment:"PASSWORD"` }
Postgres configures the Postgres connection. These options come from https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters
type SSL ¶
type SSL struct { CertPath string `environment:"CERT_PATH"` KeyPath string `environment:"KEY_PATH"` }
SSL stores paths the the cert/key files
type Server ¶
type Server struct { Addr string `environment:"ADDR"` ReadHeaderTimeoutMillis int `environment:"READ_HEADER_TIMEOUT_MILLIS"` SSL *SSL `environment:"SSL"` }
Server has all the config values which affect the http.Server which responds to requests.
func (*Server) ReadHeaderTimeout ¶
ReadHeaderTimeout returns the time the server will wait for the client to send the HTTP headers before it just times out the request.