Documentation
¶
Index ¶
Constants ¶
const DEFAULT_CONFIG_DIR = ".agent_composer/config"
const DEFAULT_DATA_DIR = ".agent_composer"
const DEFAULT_LOCALE = "en-US"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppSettings ¶
type Config ¶
type Config struct {
App AppSettings `mapstructure:"app"`
Promtail promtail.Config `mapstructure:"promtail"`
Postgres postgres.ConnectionConfig `mapstructure:"postgres"`
SQLite sqlite.ConnectionConfig `mapstructure:"sqlite"`
}
Config contains the configuration file settings. The database defaults to a local SQLite file, and a postgres section opts into PostgreSQL instead.
type ConfigReport ¶ added in v0.3.0
type ConfigReport struct {
Environment string `json:"environment"`
ConfigFile string `json:"config_file"`
ConfigFileFound bool `json:"config_file_found"`
Database string `json:"database"`
// Source explains why that database engine was selected.
Source string `json:"source"`
SQLitePath string `json:"sqlite_path,omitempty"`
PostgresHost string `json:"postgres_host,omitempty"`
PostgresDatabase string `json:"postgres_database,omitempty"`
HomeDir string `json:"home_dir"`
AppPort string `json:"app_port"`
}
ConfigReport describes the effective configuration and where each load-bearing choice came from, so a user never has to guess why agc connected to one database or another.
type Controller ¶
type Controller struct {
ctrl.BaseController
Config Config
EnvVars EnvVars
DB *relational.DB
// contains filtered or unexported fields
}
func Load ¶ added in v0.3.0
func Load(writer io.Writer) (*Controller, error)
Load resolves the configuration without connecting to any database — for commands that only inspect settings.
func New ¶
func New() (*Controller, error)
func NewWithLogWriter ¶ added in v0.3.0
func NewWithLogWriter(writer io.Writer) (*Controller, error)
func (*Controller) ConfigReport ¶ added in v0.3.0
func (controller *Controller) ConfigReport() (*ConfigReport, error)
ConfigReport works on a Load-ed controller — no database connection is needed or made.
func (*Controller) Setup ¶
func (controller *Controller) Setup() error
type EnvVars ¶
type EnvVars struct {
Environment string
ProjectRootPath string
PromtailPassword string ` mapstucture:"PROMTAIL_PASSWORD"`
PostgresPassword string ` mapstucture:"POSTGRES_PASSWORD"`
AWSSecretKey string ` mapstucture:"AWS_SECRET_KEY"`
S3SecretKey string ` mapstucture:"S3_SECRET_KEY"`
STPSecretKey string ` mapstucture:"STP_SECRET_KEY"`
STPGatewayToken string ` mapstucture:"STP_GATEWAY_TOKEN"`
FacturamaPassword string ` mapstucture:"FACTURAMA_PASSWORD"`
HikDeviceGatewayPassword string ` mapstucture:"HIK_DEVICE_GATEWAY_PASSWORD"`
}
type Locale ¶
type Locale string
Locale is a string type with validation
func NewLocaleString ¶
NewLocaleString creates a validated locale string
func (Locale) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Locale) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler