github.com/jxgolibs/go-oauth2-server@v1.0.1/config/config.go (about)

     1  package config
     2  
     3  // DatabaseConfig stores database connection options
     4  type DatabaseConfig struct {
     5  	Type         string
     6  	Host         string
     7  	Port         int
     8  	User         string
     9  	Password     string
    10  	DatabaseName string
    11  	MaxIdleConns int
    12  	MaxOpenConns int
    13  }
    14  
    15  // OauthConfig stores oauth service configuration options
    16  type OauthConfig struct {
    17  	AccessTokenLifetime  int
    18  	RefreshTokenLifetime int
    19  	AuthCodeLifetime     int
    20  }
    21  
    22  // SessionConfig stores session configuration for the web app
    23  type SessionConfig struct {
    24  	Secret string
    25  	Path   string
    26  	// MaxAge=0 means no 'Max-Age' attribute specified.
    27  	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'.
    28  	// MaxAge>0 means Max-Age attribute present and given in seconds.
    29  	MaxAge int
    30  	// When you tag a cookie with the HttpOnly flag, it tells the browser that
    31  	// this particular cookie should only be accessed by the server.
    32  	// Any attempt to access the cookie from client script is strictly forbidden.
    33  	HTTPOnly bool
    34  }
    35  
    36  // Config stores all configuration options
    37  type Config struct {
    38  	Database      DatabaseConfig
    39  	Oauth         OauthConfig
    40  	Session       SessionConfig
    41  	IsDevelopment bool
    42  }