config

package
v0.0.0-...-4101898 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	fx.Out

	DB     DBConfig     `mapstructure:"db"`
	LLM    LLMConfig    `mapstructure:"llm"`
	Server ServerConfig `mapstructure:"server"`
}

func NewConfig

func NewConfig() Config

NewConfig returns a new Config instance with values loaded from environment variables.

func NewTestConfig

func NewTestConfig() Config

NewTestConfig returns a Config instance intended for testing. TODO: assign random available ports to avoid conflicts with other tests.

type DBConfig

type DBConfig struct {
	URL string `mapstructure:"url"`
}

func (DBConfig) MigrationsDir

func (c DBConfig) MigrationsDir() string

type LLMConfig

type LLMConfig struct {
	OpenAIKey string `mapstructure:"openai_key"`

	Questions struct {
		BatchSize int           `mapstructure:"batch_size"`
		Frequency time.Duration `mapstructure:"frequency"`
	} `mapstructure:"questions"`
}

type ServerConfig

type ServerConfig struct {
	Host         string        `mapstructure:"host"`
	RESTPort     int           `mapstructure:"rest_port"`
	GRPCPort     int           `mapstructure:"grpc_port"`
	ReadTimeout  time.Duration `mapstructure:"read_timeout"`
	WriteTimeout time.Duration `mapstructure:"write_timeout"`
	JWTSecret    string        `mapstructure:"jwt_secret"`
}

func (ServerConfig) GRPCAddress

func (c ServerConfig) GRPCAddress() string

func (ServerConfig) OAPISchemaDir

func (c ServerConfig) OAPISchemaDir() string

func (ServerConfig) RESTAddress

func (c ServerConfig) RESTAddress() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳