config

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMySQLDatastoreMigrationSource     = "github://warrant-dev/warrant/migrations/datastore/mysql"
	DefaultMySQLEventstoreMigrationSource    = "github://warrant-dev/warrant/migrations/eventstore/mysql"
	DefaultPostgresDatastoreMigrationSource  = "github://warrant-dev/warrant/migrations/datastore/postgres"
	DefaultPostgresEventstoreMigrationSource = "github://warrant-dev/warrant/migrations/eventstore/postgres"
	DefaultSQLiteDatastoreMigrationSource    = "github://warrant-dev/warrant/migrations/datastore/sqlite"
	DefaultSQLiteEventstoreMigrationSource   = "github://warrant-dev/warrant/migrations/eventstore/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
	GetEventstore() *EventstoreConfig
}

type DatastoreConfig

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

type EventstoreConfig added in v0.6.0

type EventstoreConfig struct {
	MySQL             *MySQLConfig    `mapstructure:"mysql"`
	Postgres          *PostgresConfig `mapstructure:"postgres"`
	SQLite            *SQLiteConfig   `mapstructure:"sqlite"`
	SynchronizeEvents bool            `mapstructure:"synchronizeEvents"`
}

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       *DatastoreConfig  `mapstructure:"datastore"`
	Eventstore      *EventstoreConfig `mapstructure:"eventstore"`
	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) GetEventstore added in v0.13.0

func (warrantConfig WarrantConfig) GetEventstore() *EventstoreConfig

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

Jump to

Keyboard shortcuts

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