config

package
v0.0.0-...-e9ab30c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	Database: DatabaseConfig{
		Type:         "mysql",
		Host:         "localhost",
		Port:         3306,
		User:         "root",
		Password:     "root",
		DatabaseName: "gravitee",
		MaxIdleConns: 5,
		MaxOpenConns: 5,
	},
	Oauth: OauthConfig{
		AccessTokenLifetime:  3600,
		RefreshTokenLifetime: 1209600,
		AuthCodeLifetime:     3600,
	},
	Session: SessionConfig{
		Secret:   "test_secret",
		Path:     "/",
		MaxAge:   86400 * 7,
		HttpOnly: true,
	},
	IsDevelop: true,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Database   DatabaseConfig
	Oauth      OauthConfig
	Session    SessionConfig
	ServerPort int  `default:"8080"`
	IsDevelop  bool `default:"True"`
}

func NewConfig

func NewConfig(configFile string) *Config

func NewDefaultConfig

func NewDefaultConfig() *Config

type DatabaseConfig

type DatabaseConfig struct {
	Type         string `default:"mysql"`
	Host         string `default:"localhost"`
	Port         int    `default:"3306"`
	User         string `default:"root"`
	Password     string `default:"root"`
	DatabaseName string `default:"gravitee"`
	MaxIdleConns int    `default:"5"`
	MaxOpenConns int    `default:"5"`
}

type OauthConfig

type OauthConfig struct {
	AccessTokenLifetime  int `default:"3600"`    // default to 1 hour
	RefreshTokenLifetime int `default:"1209600"` // default to 14 days
	AuthCodeLifetime     int `default:"3600"`    // default to 1 hour
}

type SessionConfig

type SessionConfig struct {
	Secret string `default:"test_secret"`
	Path   string `default:"/"`
	// 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 `default:"604800"`
	// 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 `default:"True"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL