config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudRun

type CloudRun struct {
	User     string `envconfig:"GATES_DB_USER"`
	Password string `envconfig:"GATES_DB_PASSWORD"`
	Socket   string `default:"/cloudsql" envconfig:"GATES_DB_SOCKET_DIR"`
	Instance string `envconfig:"INSTANCE_CONNECTION_NAME"`
	Name     string `envconfig:"GATES_DB_NAME"`
}

CloudRun database setting for google cloud run

type Config

type Config struct {
	Server   Server
	Gitea    Gitea
	Github   Github
	GitLab   GitLab
	Database Database
	CloudRun CloudRun
}

Config of application

func Environ

func Environ() (*Config, error)

Environ setup configure from environment variables

func (*Config) Providers

func (c *Config) Providers() []core.SCMProvider

Providers of all available SCM

type Database

type Database struct {
	AutoMigrate bool   `default:"true" envconfig:"GATES_DB_AUTO_MIGRATE"`
	Driver      string `default:"sqlite3" envconfig:"GATES_DB_DRIVER"`
	Host        string `envconfig:"GATES_DB_HOST"`
	Port        string `envconfig:"GATES_DB_PORT"`
	User        string `envconfig:"GATES_DB_USER"`
	Name        string `default:"core.db" envconfig:"GATES_DB_NAME"`
	Password    string `envconfig:"GATES_DB_PASSWORD"`
}

Database setting

type GitLab added in v0.2.0

type GitLab struct {
	Server       string   `default:"https://gitlab.com" envconfig:"GATES_GITLAB_SERVER"`
	ClientID     string   `envconfig:"GATES_GITLAB_CLIENT_ID"`
	ClientSecret string   `envconfig:"GATES_GITLAB_CLIENT_SECRET"`
	SkipVerity   bool     `envconfig:"GATES_GITLAB_SKIP_VERIFY"`
	Scope        []string `default:"api,read_user,read_api,read_repository,profile,email" envconfig:"GATES_GITLAB_SCOPE"`
}

GitLab connection setting

type Gitea

type Gitea struct {
	Server       string   `envconfig:"GATES_GITEA_SERVER"`
	ClientID     string   `envconfig:"GATES_GITEA_CLIENT_ID"`
	ClientSecret string   `envconfig:"GATES_GITEA_CLIENT_SECRET"`
	SkipVerity   bool     `envconfig:"GATES_GITEA_SKIP_VERIFY"`
	Scope        []string `default:"repo,repo:status,user:email,read:org" envconfig:"GATES_GITEA_SCOPE"`
}

Gitea connection setting

type Github

type Github struct {
	Server       string   `default:"https://github.com" envconfig:"GATES_GITHUB_SERVER"`
	APIServer    string   `default:"https://api.github.com" envconfig:"GATES_GITHUB_API_SERVER"`
	ClientID     string   `envconfig:"GATES_GITHUB_CLIENT_ID"`
	ClientSecret string   `envconfig:"GATES_GITHUB_CLIENT_SECRET"`
	SkipVerity   bool     `envconfig:"GATES_GITHUB_SKIP_VERIFY"`
	Scope        []string `default:"repo,repo:status,user:email,read:org" envconfig:"GATES_GITHUB_SCOPE"`
}

Github connection setting

type Server

type Server struct {
	Secret      string `default:"secret" envconfig:"GATES_SERVER_SECRET"`
	Addr        string `default:"http://localhost:8080" envconfig:"GATES_SERVER_ADDR"`
	Base        string `envconfig:"GATES_SERVER_BASE"`
	SkipVerity  bool   `default:"true" envconfig:"GATES_SERVER_SKIP_VERIFY"`
	ServerPort  string `envconfig:"GATES_SERVER_PORT"`
	CloudPort   string `envconfig:"PORT"`
	OAuthClient string `default:"client"`
}

Server setting

func (Server) BaseURL

func (server Server) BaseURL() string

BaseURL sanitize the Base string to URL format

func (Server) Port

func (server Server) Port() string

Port opened for the current server

func (Server) URL

func (server Server) URL() string

URL of the server

Jump to

Keyboard shortcuts

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