config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFileName is default name for the configuration file
	ConfigFileName = "promptviser-config.yaml"
)
View Source
const (
	// WFEServerName specifies server name for Web Front End
	WFEServerName = "wfe"
)

Variables

This section is empty.

Functions

func DefaultFactory

func DefaultFactory() (*configloader.Factory, error)

DefaultFactory returns default configuration factory

func LoadForHostName

func LoadForHostName(configFile, hostnameOverride string, config any) error

LoadForHostName will load the configuration from the named config file for specified host name, apply any overrides, and resolve relative directory locations.

func LoadWithOverride

func LoadWithOverride(configFile, configOverride string, config any, sc configloader.SecretProvider) error

LoadWithOverride will load the configuration from the named config and optional override file

Types

type Configuration

type Configuration struct {

	// Region specifies the Region / Datacenter where the instance is running
	Region string `json:"region,omitempty" yaml:"region,omitempty"`

	// Environment specifies the environment where the instance is running: prod|stage|dev
	Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`

	// ServiceName specifies the service name to be used in logs, metrics, etc
	ServiceName string `json:"service,omitempty" yaml:"service,omitempty"`

	// ClusterName specifies the cluster name
	ClusterName string `json:"cluster,omitempty" yaml:"cluster,omitempty"`

	// Metrics specifies the metrics pipeline configuration
	Metrics appinit.Metrics `json:"metrics" yaml:"metrics"`

	// LogLevels specifies the log levels per package
	LogLevels []xlog.RepoLogLevel `json:"log_levels" yaml:"log_levels"`

	// SQL specifies the configuration for SQL provider
	SQL SQL `json:"sql" yaml:"sql"`

	// JWT specifies configuration file for the JWT provider
	JWT string `json:"jwt_provider" yaml:"jwt_provider"`

	// OAuth2Clients specifies configuration file for the OAuth2 Clients provider
	OAuth2Clients string `json:"oauth2_clients" yaml:"oauth2_clients"`

	// HTTPServers specifies a list of servers that expose HTTP or gRPC services
	HTTPServers map[string]*gserver.Config `json:"servers" yaml:"servers"`

	// Client specifies configurations for the client to connect to the cluster
	Client client.Config `json:"client" yaml:"client"`

	// Tasks specifies array of tasks
	Tasks []Task `json:"tasks" yaml:"tasks"`
}

Configuration contains the user configurable data for the service

func Load

func Load(configFile string) (*Configuration, error)

Load will load the configuration from the named config file, apply any overrides, and resolve relative directory locations.

type SQL

type SQL struct {
	// TODO: delete Driver after deployment to Production
	// Driver specifies the driver name: postgres|mysql.
	Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`

	// DataSource specifies the connection string. It can be prefixed with file:// or env:// to load the source from a file or environment variable.
	DataSource string `json:"data_source,omitempty" yaml:"data_source,omitempty"`

	// MigrationsDir specifies the directory that contains migrations.
	MigrationsDir string `json:"migrations_dir,omitempty" yaml:"migrations_dir,omitempty"`

	// ForceVersion specifies to force version.
	ForceVersion int `json:"force_version,omitempty" yaml:"force_version,omitempty"`

	// MigrateVersion specifies to migrate version.
	MigrateVersion int `json:"migrate_version,omitempty" yaml:"migrate_version,omitempty"`
}

type Task

type Task struct {

	// Name specifies the name of the task.
	Name string `json:"name" yaml:"name"`

	// Schedule specifies the schedule of this task.
	Schedule string `json:"schedule" yaml:"schedule"`

	// Args specifies parameters for the task.
	Args []string `json:"args" yaml:"args"`
}

Task specifies configuration of a single task.

Jump to

Keyboard shortcuts

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