Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cnf = &Config{ Database: DatabaseConfig{ Type: "postgres", Host: "postgres", Port: 5432, User: "go_oauth2_server", Password: "", DatabaseName: "go_oauth2_server", MaxIdleConns: 5, MaxOpenConns: 5, }, Oauth: OauthConfig{ AccessTokenLifetime: 3600, RefreshTokenLifetime: 1209600, AuthCodeLifetime: 3600, }, Session: SessionConfig{ Secret: "test_secret", Path: "/", MaxAge: 86400 * 7, HTTPOnly: true, }, IsDevelopment: true, }
Cnf ... Let's start with some sensible defaults
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { LoadConfig() (*Config, error) RefreshConfig(newCnf *Config) InitConfigBackend() }
Backend defines a configuration backend, implement this interface to support additional backends
type Config ¶
type Config struct { Database DatabaseConfig Oauth OauthConfig Session SessionConfig IsDevelopment bool }
Config stores all configuration options
type DatabaseConfig ¶
type DatabaseConfig struct { Type string Host string Port int User string Password string DatabaseName string MaxIdleConns int MaxOpenConns int }
DatabaseConfig stores database connection options
type OauthConfig ¶
OauthConfig stores oauth service configuration options
type SessionConfig ¶
type SessionConfig struct { Secret string Path string // MaxAge=0 means no 'Max-Age' attribute specified. // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'. // MaxAge>0 means Max-Age attribute present and given in seconds. MaxAge int // When you tag a cookie with the HttpOnly flag, it tells the browser that // this particular cookie should only be accessed by the server. // Any attempt to access the cookie from client script is strictly forbidden. HTTPOnly bool }
SessionConfig stores session configuration for the web app
Click to show internal directories.
Click to hide internal directories.