config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SettingsFolder       = "."
	SettingsName         = "settings"
	SettingsOverrideName = "settings_local"
	SettingsEnvPrefix    = "app"
)
View Source
const (
	ContextKeyDao        string = "dao"
	ContextKeyAuthRecord string = "authRecord"
	ContextKeyApiKey     string = "api_key"
	ContextKeyUserId     string = "user_id"
	ContextKeyRequestId  string = "X-Request-ID"
)

Variables

This section is empty.

Functions

func Load

func Load(cfg interface{})

Load use viper to load config read settings.{yaml/json/toml} and unmarshal to interface cfg settings_local will override config in settings support auto reload when file change auto read config from env with prefix 'APP_' and will auto convert "_" to "." for example APP_TELEGRAM_TOKEN will map to telegram.token avoid to use "_" in config name for better env reading

Types

type Admin

type Admin struct {
	Email    string
	Password string
}

type Axiom

type Axiom struct {
	Token   string
	Dataset string
}

type Config

type Config struct {
	Service  ServiceConfig
	Admins   []Admin
	LLMs     []LLMConfig
	Axiom    Axiom
	Telegram struct {
		Token string `yaml:"token"`
	}
	ClaudeWeb struct {
		Token string `yaml:"token"`
	}
	Bard struct {
		Token string `yaml:"token"`
	}
	ReadEase    ReadEase
	CookieCloud CookieCloud
}

func GetConfig

func GetConfig() *Config

type CookieCloud

type CookieCloud struct {
	Host string
	UUID string
	Pass string
}

type LLMConfig

type LLMConfig struct {
	Type        string // openai or azureOpenAI
	ApiEndpoint string
	ApiKey      string
	ApiVersion  string
	Models      []string // valid model ids
}

type ReadEase

type ReadEase struct {
	TelegramChannel int64 `yaml:"telegramChannel"`
	TopStoriesCnt   int   `yaml:"topStoriesCnt"`
}

type ServiceConfig

type ServiceConfig struct {
	Name     string
	Host     string
	Port     string
	URL      string
	LogLevel string
	Env      string
}

Jump to

Keyboard shortcuts

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