config

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMySQLDatastoreMigrationSource    = "github://warrant-dev/warrant/migrations/datastore/mysql"
	DefaultPostgresDatastoreMigrationSource = "github://warrant-dev/warrant/migrations/datastore/postgres"
	DefaultSQLiteDatastoreMigrationSource   = "github://warrant-dev/warrant/migrations/datastore/sqlite"
	DefaultAuthenticationUserIdClaim        = "sub"
	PrefixWarrant                           = "warrant"
	ConfigFileName                          = "warrant.yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig added in v0.7.0

type AuthConfig struct {
	ApiKey   string              `mapstructure:"apiKey"`
	Provider *AuthProviderConfig `mapstructure:"providers"`
}

type AuthProviderConfig added in v0.13.0

type AuthProviderConfig struct {
	Name          string `mapstructure:"name"`
	PublicKey     string `mapstructure:"publicKey"`
	UserIdClaim   string `mapstructure:"userIdClaim"`
	TenantIdClaim string `mapstructure:"tenantIdClaim"`
}

type CheckConfig added in v0.31.0

type CheckConfig struct {
	Concurrency    int           `mapstructure:"concurrency"`
	MaxConcurrency int           `mapstructure:"maxConcurrency"`
	Timeout        time.Duration `mapstructure:"timeout"`
}

type Config

type Config interface {
	GetPort() int
	GetLogLevel() int8
	GetEnableAccessLog() bool
	GetAutoMigrate() bool
	GetDatastore() DatastoreConfig
}

type DatastoreConfig

type DatastoreConfig interface {
	GetMySQL() *MySQLConfig
	GetPostgres() *PostgresConfig
	GetSQLite() *SQLiteConfig
}

type MySQLConfig

type MySQLConfig struct {
	Username                 string        `mapstructure:"username"`
	Password                 string        `mapstructure:"password"`
	Hostname                 string        `mapstructure:"hostname"`
	Database                 string        `mapstructure:"database"`
	MigrationSource          string        `mapstructure:"migrationSource"`
	MaxIdleConnections       int           `mapstructure:"maxIdleConnections"`
	ConnMaxIdleTime          time.Duration `mapstructure:"connMaxIdleTime"`
	MaxOpenConnections       int           `mapstructure:"maxOpenConnections"`
	ConnMaxLifetime          time.Duration `mapstructure:"connMaxLifetime"`
	ReaderHostname           string        `mapstructure:"readerHostname"`
	ReaderMaxIdleConnections int           `mapstructure:"readerMaxIdleConnections"`
	ReaderMaxOpenConnections int           `mapstructure:"readerMaxOpenConnections"`
	DSN                      string        `mapstructure:"dsn"`
	ReaderDSN                string        `mapstructure:"readerDsn"`
}

type PostgresConfig added in v0.4.0

type PostgresConfig struct {
	Username                 string        `mapstructure:"username"`
	Password                 string        `mapstructure:"password"`
	Hostname                 string        `mapstructure:"hostname"`
	Database                 string        `mapstructure:"database"`
	SSLMode                  string        `mapstructure:"sslmode"`
	MigrationSource          string        `mapstructure:"migrationSource"`
	MaxIdleConnections       int           `mapstructure:"maxIdleConnections"`
	ConnMaxIdleTime          time.Duration `mapstructure:"connMaxIdleTime"`
	MaxOpenConnections       int           `mapstructure:"maxOpenConnections"`
	ConnMaxLifetime          time.Duration `mapstructure:"connMaxLifetime"`
	ReaderHostname           string        `mapstructure:"readerHostname"`
	ReaderMaxIdleConnections int           `mapstructure:"readerMaxIdleConnections"`
	ReaderMaxOpenConnections int           `mapstructure:"readerMaxOpenConnections"`
}

type SQLiteConfig added in v0.11.0

type SQLiteConfig struct {
	Database           string        `mapstructure:"database"`
	InMemory           bool          `mapstructure:"inMemory"`
	MigrationSource    string        `mapstructure:"migrationSource"`
	MaxIdleConnections int           `mapstructure:"maxIdleConnections"`
	ConnMaxIdleTime    time.Duration `mapstructure:"connMaxIdleTime"`
	MaxOpenConnections int           `mapstructure:"maxOpenConnections"`
	ConnMaxLifetime    time.Duration `mapstructure:"connMaxLifetime"`
}

type WarrantConfig added in v0.13.0

type WarrantConfig struct {
	Port            int                     `mapstructure:"port"`
	LogLevel        int8                    `mapstructure:"logLevel"`
	EnableAccessLog bool                    `mapstructure:"enableAccessLog"`
	AutoMigrate     bool                    `mapstructure:"autoMigrate"`
	Datastore       *WarrantDatastoreConfig `mapstructure:"datastore"`
	Authentication  *AuthConfig             `mapstructure:"authentication"`
	Check           *CheckConfig            `mapstructure:"check"`
}

func NewConfig

func NewConfig() WarrantConfig

func (WarrantConfig) GetAuthentication added in v0.13.0

func (warrantConfig WarrantConfig) GetAuthentication() *AuthConfig

func (WarrantConfig) GetAutoMigrate added in v0.13.0

func (warrantConfig WarrantConfig) GetAutoMigrate() bool

func (WarrantConfig) GetCheck added in v0.31.0

func (warrantConfig WarrantConfig) GetCheck() *CheckConfig

func (WarrantConfig) GetDatastore added in v0.13.0

func (warrantConfig WarrantConfig) GetDatastore() DatastoreConfig

func (WarrantConfig) GetEnableAccessLog added in v0.13.0

func (warrantConfig WarrantConfig) GetEnableAccessLog() bool

func (WarrantConfig) GetLogLevel added in v0.13.0

func (warrantConfig WarrantConfig) GetLogLevel() int8

func (WarrantConfig) GetPort added in v0.13.0

func (warrantConfig WarrantConfig) GetPort() int

type WarrantDatastoreConfig added in v1.14.0

type WarrantDatastoreConfig struct {
	MySQL    *MySQLConfig    `mapstructure:"mysql"`
	Postgres *PostgresConfig `mapstructure:"postgres"`
	SQLite   *SQLiteConfig   `mapstructure:"sqlite"`
}

func (WarrantDatastoreConfig) GetMySQL added in v1.14.0

func (warrantDatastoreConfig WarrantDatastoreConfig) GetMySQL() *MySQLConfig

func (WarrantDatastoreConfig) GetPostgres added in v1.14.0

func (warrantDatastoreConfig WarrantDatastoreConfig) GetPostgres() *PostgresConfig

func (WarrantDatastoreConfig) GetSQLite added in v1.14.0

func (warrantDatastoreConfig WarrantDatastoreConfig) GetSQLite() *SQLiteConfig

Jump to

Keyboard shortcuts

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