skyconfig

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	HTTP struct {
		Host string `json:"host"`
	} `json:"http"`
	App struct {
		Name            string     `json:"name"`
		APIKey          string     `json:"api_key"`
		MasterKey       string     `json:"master_key"`
		AccessControl   string     `json:"access_control"`
		AuthRecordKeys  [][]string `json:"auth_record_keys"`
		DevMode         bool       `json:"dev_mode"`
		CORSHost        string     `json:"cors_host"`
		Slave           bool       `json:"slave"`
		ResponseTimeout int64      `json:"response_timeout"`
	} `json:"app"`
	DB struct {
		ImplName string `json:"implementation"`
		Option   string `json:"option"`
	} `json:"database"`
	TokenStore struct {
		ImplName string `json:"implementation"`
		Path     string `json:"path"`
		Prefix   string `json:"prefix"`
		Expiry   int64  `json:"expiry"`
		Secret   string `json:"secret"`
	} `json:"-"`
	Auth struct {
		CustomTokenSecret string `json:"custom_token_secret"`
	} `json:"auth"`
	AssetStore struct {
		ImplName string `json:"implementation"`
		Public   bool   `json:"public"`

		FileSystemStore struct {
			Path      string `json:"-"`
			URLPrefix string `json:"url_prefix"`
			Secret    string `json:"secret"`
		} `json:"fs"`

		S3Store struct {
			AccessToken string `json:"access_key"`
			SecretToken string `json:"secret_key"`
			Region      string `json:"region"`
			Bucket      string `json:"bucket"`
			URLPrefix   string `json:"url_prefix"`
		} `json:"s3"`

		CloudStore struct {
			Host          string `json:"host"`
			Token         string `json:"token"`
			PublicPrefix  string `json:"public_prefix"`
			PrivatePrefix string `json:"private_prefix"`
		} `json:"cloud"`
	} `json:"asset_store"`
	APNS struct {
		Enable    bool   `json:"enable"`
		Type      string `json:"type"`
		Env       string `json:"env"`
		Keepalive int    `json:"keepalive"`

		CertConfig struct {
			Cert     string `json:"cert"`
			Key      string `json:"key"`
			CertPath string `json:"-"`
			KeyPath  string `json:"-"`
		} `json:"cert_config"`

		TokenConfig struct {
			TeamID  string `json:"team_id"`
			KeyID   string `json:"key_id"`
			Key     string `json:"key"`
			KeyPath string `json:"-"`
		} `json:"token_config"`
	} `json:"apns"`
	FCM struct {
		Enable bool   `json:"enable"`
		Type   string `json:"type"`

		ServiceAccount struct {
			Key     string `json:"key"`
			KeyPath string `json:"-"`
		} `json:"service_account"`
		Server struct {
			Key string `json:"key"`
		}
	} `json:"fcm"`
	Baidu struct {
		Enable    bool   `json:"enable"`
		APIKey    string `json:"api_key"`
		SecretKey string `json:"secret_key"`
	} `json:"baidu"`
	LOG struct {
		Level           string            `json:"-"`
		LoggersLevel    map[string]string `json:"-"`
		RouterByteLimit int64             `json:"-"`
		Formatter       string            `json:"-"`
	} `json:"log"`
	LogHook struct {
		SentryDSN   string
		SentryLevel string
	} `json:"-"`
	Zmq struct {
		Timeout   int `json:"timeout"`
		MaxBounce int `json:"max_bounce"`
	} `json:"zmq"`
	Plugin    map[string]*PluginConfig `json:"-"`
	UserAudit struct {
		Enabled             bool     `json:"enabled"`
		TrailHandlerURL     string   `json:"trail_handler_url"`
		PwMinLength         int      `json:"pw_min_length"`
		PwUppercaseRequired bool     `json:"pw_uppercase_required"`
		PwLowercaseRequired bool     `json:"pw_lowercase_required"`
		PwDigitRequired     bool     `json:"pw_digit_required"`
		PwSymbolRequired    bool     `json:"pw_symbol_required"`
		PwMinGuessableLevel int      `json:"pw_min_guessable_level"`
		PwExcludedKeywords  []string `json:"pw_excluded_keywords"`
		PwExcludedFields    []string `json:"pw_excluded_fields"`
		PwHistorySize       int      `json:"pw_history_size"`
		PwHistoryDays       int      `json:"pw_history_days"`
		PwExpiryDays        int      `json:"pw_expiry_days"`
	} `json:"user_audit"`
	Verification struct {
		Required bool `json:"required"`
	} `json:"verification"`
}

Configuration is Skygear's configuration The configuration will load in following order: 1. The ENV 2. The key/value in .env file 3. The config in *.ini (To-be depreacted)

func NewConfiguration

func NewConfiguration() Configuration

func NewConfigurationWithKeys

func NewConfigurationWithKeys() Configuration

func (*Configuration) ReadFromEnv

func (config *Configuration) ReadFromEnv()

ReadFromEnv reads from environment variable and update the configuration. nolint: gocyclo

func (*Configuration) Validate

func (config *Configuration) Validate() error

type PluginConfig

type PluginConfig struct {
	Transport string
	Path      string
	Args      []string
}

Jump to

Keyboard shortcuts

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