config

package
v0.0.0-...-94a8b92 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorsOptions

func CorsOptions(clientOriginUrl string) cors.Options

func GetConfigOpt

GetConfigOpt -- Get db, redis, mailer, grpc, jwt, oauth, user, tracer

func GetViper

func GetViper() (*viper.Viper, error)

GetViper -- init viper

func InitTracerProvider

func InitTracerProvider() (*sdktrace.TracerProvider, error)

InitTracerProvider - configures an OpenTelemetry exporter and trace provider.

func SecureOptions

func SecureOptions() secure.Options

func SetUpLogging

func SetUpLogging(logPath string) *zap.Logger

SetUpLogging - SetUpLogging

Types

type DBOptions

type DBOptions struct {
	DB                    string `mapstructure:"db"`
	Host                  string `mapstructure:"hostname"`
	Port                  string `mapstructure:"port"`
	User                  string `mapstructure:"user"`
	Password              string `mapstructure:"password"`
	Schema                string `mapstructure:"db_schema"`
	LimitSQLRows          string `mapstructure:"limit_sql_rows"`
	MySQLTestFilePath     string `mapstructure:"mysql_test_file_path"`
	MySQLSchemaFilePath   string `mapstructure:"mysql_schema_file_path"`
	MySQLTruncateFilePath string `mapstructure:"mysql_truncate_file_path"`
	PgSQLTestFilePath     string `mapstructure:"pgsql_test_file_path"`
	PgSQLSchemaFilePath   string `mapstructure:"pgsql_schema_file_path"`
	PgSQLTruncateFilePath string `mapstructure:"pgsql_truncate_file_path"`
}

DBOptions - for db config

func GetDbConfig

func GetDbConfig(log *zap.Logger, v *viper.Viper, isTest bool, db string, dbHost string, dbPort string, dbUser string, dbPassword string, dbSchema string, dbMysqlTestFilePath string, dbMysqlSchemaFilePath string, dbMysqlTruncateFilePath string, dbPgsqlTestFilePath string, dbPgsqlSchemaFilePath string, dbPgsqlTruncateFilePath string) (*DBOptions, error)

GetDbConfig -- read DB config options

type GrpcServerOptions

type GrpcServerOptions struct {
	GrpcUserServerPort      string `mapstructure:"grpc_user_server_port"`
	GrpcPartyServerPort     string `mapstructure:"grpc_party_server_port"`
	GrpcBkgServerPort       string `mapstructure:"grpc_bkg_server_port"`
	GrpcEblServerPort       string `mapstructure:"grpc_ebl_server_port"`
	GrpcEventCoreServerPort string `mapstructure:"grpc_event_core_server_port"`
	GrpcJitServerPort       string `mapstructure:"grpc_jit_server_port"`
	GrpcOvsServerPort       string `mapstructure:"grpc_ovs_server_port"`
	GrpcTntServerPort       string `mapstructure:"grpc_tnt_server_port"`
	GrpcSearchServerPort    string `mapstructure:"grpc_search_server_port"`
	GrpcCaCertPath          string `mapstructure:"grpc_ca_cert_path"`
	GrpcCertPath            string `mapstructure:"grpc_cert_path"`
	GrpcKeyPath             string `mapstructure:"grpc_key_path"`
}

GrpcServerOptions - for grpc server config

func GetGrpcServerConfig

func GetGrpcServerConfig(log *zap.Logger, v *viper.Viper) (*GrpcServerOptions, error)

GetGrpcServerConfig -- read grpc server config options

type JWTOptions

type JWTOptions struct {
	JWTKey        []byte
	JWTDuration   int
	AccessSecret  string
	RefreshSecret string
}

JWTOptions - for JWT config

func GetJWTConfig

func GetJWTConfig(log *zap.Logger, v *viper.Viper, isTest bool, jwtKey string, jwtDuration string) (*JWTOptions, error)

GetJWTConfig -- read JWT config options

type LogOptions

type LogOptions struct {
	Path          string `mapstructure:"log_file_path"`
	UserPath      string `mapstructure:"log_user_file_path"`
	PartyPath     string `mapstructure:"log_party_file_path"`
	BkgPath       string `mapstructure:"log_bkg_file_path"`
	EblPath       string `mapstructure:"log_ebl_file_path"`
	EventCorePath string `mapstructure:"log_event_core_file_path"`
	JitPath       string `mapstructure:"log_jit_file_path"`
	OvsPath       string `mapstructure:"log_ovs_file_path"`
	TntPath       string `mapstructure:"log_tnt_file_path"`
	SearchPath    string `mapstructure:"log_search_file_path"`
	Level         string `mapstructure:"log_level"`
}

LogOptions - for logging

func GetLogConfig

func GetLogConfig(v *viper.Viper) (*LogOptions, error)

GetLogConfig -- read log config options

type MailerOptions

type MailerOptions struct {
	User     string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Port     int    `mapstructure:"port"`
	Server   string `mapstructure:"server"`
}

MailerOptions - for mailer config

func GetMailerConfig

func GetMailerConfig(log *zap.Logger, v *viper.Viper) (*MailerOptions, error)

GetMailerConfig -- read mailer config options

type OauthOptions

type OauthOptions struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
}

OauthOptions - for oauth config

func GetOauthConfig

func GetOauthConfig(log *zap.Logger, v *viper.Viper) (*OauthOptions, error)

GetOauthConfig -- read oauth config options

type RateOptions

type RateOptions struct {
	UMaxRate          int `mapstructure:"u_max_rate"`
	UMaxBurst         int `mapstructure:"u_max_burst"`
	UserMaxRate       int `mapstructure:"user_max_rate"`
	UserMaxBurst      int `mapstructure:"user_max_burst"`
	PartyMaxRate      int `mapstructure:"party_max_rate"`
	PartyMaxBurst     int `mapstructure:"party_max_burst"`
	BkgMaxRate        int `mapstructure:"bkg_max_rate"`
	BkgMaxBurst       int `mapstructure:"bkg_max_burst"`
	SearchMaxRate     int `mapstructure:"search_max_rate"`
	SearchMaxBurst    int `mapstructure:"search_max_burst"`
	EblMaxRate        int `mapstructure:"ebl_max_rate"`
	EblMaxBurst       int `mapstructure:"ebl_max_burst"`
	EventCoreMaxRate  int `mapstructure:"event_core_max_rate"`
	EventCoreMaxBurst int `mapstructure:"event_core_max_burst"`
	JitMaxRate        int `mapstructure:"jit_max_rate"`
	JitMaxBurst       int `mapstructure:"jit_max_burst"`
	OvsMaxRate        int `mapstructure:"ovs_max_rate"`
	OvsMaxBurst       int `mapstructure:"ovs_max_burst"`
	TntMaxRate        int `mapstructure:"tnt_max_rate"`
	TntMaxBurst       int `mapstructure:"tnt_max_burst"`
}

RateOptions - for rate limiting requests

func GetRateConfig

func GetRateConfig(log *zap.Logger, v *viper.Viper) (*RateOptions, error)

GetRateConfig -- read rate config options

type RedisOptions

type RedisOptions struct {
	Addr string `mapstructure:"addr"`
}

RedisOptions - for redis config

func GetRedisConfig

func GetRedisConfig(log *zap.Logger, v *viper.Viper) (*RedisOptions, error)

GetRedisConfig -- read redis config options

type ServerOptions

type ServerOptions struct {
	ServerAddr      string `mapstructure:"server_addr"`
	ServerTLS       string `mapstructure:"server_tls"`
	CaCertPath      string `mapstructure:"ca_cert_path"`
	CertPath        string `mapstructure:"cert_path"`
	KeyPath         string `mapstructure:"key_path"`
	ClientOriginUrl string `mapstructure:"client_original_url"`
	Auth0Audience   string `mapstructure:"auth0_audience"`
	Auth0Domain     string `mapstructure:"auth0_domain"`
	Auth0ClientId   string `mapstructure:"auth0_client_id"`
	Auth0Connection string `mapstructure:"auth0_connection"`
	Auth0MgmtToken  string `mapstructure:"auth0_mgmt_token"`
	Auth0ApiId      string `mapstructure:"auth0_api_id"`
}

ServerOptions - for server config

func GetServerConfig

func GetServerConfig(log *zap.Logger, v *viper.Viper) (*ServerOptions, error)

GetServerConfig -- read server config options

type UptraceOptions

type UptraceOptions struct {
	Dsn string `mapstructure:"dsn"`
}

UptraceOptions - for uptrace config

func GetUptraceConfig

func GetUptraceConfig(log *zap.Logger, v *viper.Viper) (*UptraceOptions, error)

GetUptraceConfig -- read Uptrace config options

type UserOptions

type UserOptions struct {
	ConfirmTokenDuration string `mapstructure:"confirm_token_duration"`
	ResetTokenDuration   string `mapstructure:"reset_token_duration"`
}

UserOptions - for user login

func GetUserConfig

func GetUserConfig(log *zap.Logger, v *viper.Viper) (*UserOptions, error)

GetUserConfig -- read user config options

type UserTestOptions

type UserTestOptions struct {
	// Email     string `mapstructure:"email"`
	// Password  string `mapstructure:"password"`
	RequestId   string `mapstructure:"request_id"`
	Tokenstring string `mapstructure:"tokenstring"`
}

UserTestOptions - for test user login

func GetUserTestConfig

func GetUserTestConfig(log *zap.Logger, v *viper.Viper) (*UserTestOptions, error)

GetUserTestConfig -- read user test config options

Jump to

Keyboard shortcuts

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