config

package
v0.0.0-...-1c246ab Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildDate string
View Source
var GitCommit string
View Source
var OSBuildName string
View Source
var Service = "proxy-service"
View Source
var Version = "v1.0.0"

Functions

This section is empty.

Types

type BackendService

type BackendService struct {
	Tribe    string `yaml:"tribe"`
	Name     string `yaml:"name"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type Config

type Config interface {
	Init(configPath string) error
	Get() *MainConfig
}

func New

func New() Config

type MainConfig

type MainConfig struct {
	Log struct {
		Level  string `yaml:"level" validate:"oneof=trace debug info warn error fatal panic"`
		Format string `yaml:"format" validate:"oneof=text json"`
	} `yaml:"log"`
	APM struct {
		Enabled bool     `yaml:"enabled"`
		Host    string   `yaml:"host"`
		Port    int      `yaml:"port" validate:"required,min=1,max=65535"`
		Rate    *float64 `yaml:"rate" validate:"omitempty,min=0.1,max=1"`
	} `yaml:"apm"`
	App struct {
		Name    string `yaml:"name" validate:"required"`
		Port    int    `yaml:"port" validate:"required,min=1,max=65535"`
		Version string `yaml:"version" validate:"required"`
		Env     string `yaml:"env" validate:"required"`
		Tribe   string `yaml:"tribe" validate:"required"`
	}
	Redis struct {
		Host     string `yaml:"host" validate:"required"`
		Port     int    `yaml:"port" validate:"required"`
		Password string `yaml:"password" validate:"required"`
		DB       int    `yaml:"db"`
	}
	Mongo struct {
		Host     string `yaml:"host" validate:"required"`
		Port     int    `yaml:"port" validate:"required"`
		Username string `yaml:"username" validate:"required"`
		Password string `yaml:"password" validate:"required"`
		DB       string `yaml:"db" validate:"required"`
	}
	UI struct {
		Host string `yaml:"host" validate:"required"`
	} `yaml:"ui"`
	MicrosoftOauth struct {
		TenantID     string `yaml:"tenantID" validate:"required"`
		ClientID     string `yaml:"clientID" validate:"required"`
		ClientSecret string `yaml:"clientSecret" validate:"required"`
		RedirectURL  string `yaml:"redirectURL" validate:"required"`
	} `yaml:"microsoftOauth"`
	GoogleOauth struct {
		ClientID     string `yaml:"clientID" validate:"required"`
		ClientSecret string `yaml:"clientSecret" validate:"required"`
		RedirectURL  string `yaml:"redirectURL" validate:"required"`
	} `yaml:"googleOauth"`
	OpenAI struct {
		Host          string `yaml:"host" validate:"required"`
		Path          string `yaml:"path" validate:"required"`
		ApiKey        string `yaml:"apiKey" validate:"required"`
		TokenLifetime int    `yaml:"tokenLifetime" validate:"required"`
		TokenLimit    int    `yaml:"tokenLimit" validate:"required"`
	} `yaml:"openAI"`
	Services []BackendService `yaml:"services"`
}

Jump to

Keyboard shortcuts

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