configx

package
v0.0.0-...-4fb02c9 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Name string `json:"name" yaml:"name"`

	HTTP httpx.Options `json:"http" yaml:"http"`
	GRPC GRPC          `json:"grpc" yaml:"grpc"`

	Storage struct {
		Mongodb struct {
			DSN string `json:"dsn" yaml:"dsn"`
		} `json:"mongodb" yaml:"mongodb"`

		Postgresql struct {
			DSN string `json:"dsn" yaml:"dsn"`
		} `json:"postgresql" yaml:"postgresql"`
	} `json:"storage" yaml:"storage"`

	OTel struct {
		Target string `json:"target" yaml:"target"`
	} `json:"otel" yaml:"otel"`
}

Application is the application configuration.

type Configuration

type Configuration struct {
	Log logging.Options `json:"log" yaml:"log"`

	Networks map[string]*Network     `json:"networks" yaml:"networks"`
	Services map[string]*Application `json:"services" yaml:"services"`
}

Configuration is the application configuration

func NewConfiguration

func NewConfiguration(v *viper.Viper) (*Configuration, error)

NewConfiguration creates a new configuration.

func (*Configuration) GetService

func (x *Configuration) GetService(name string) (*Application, error)

GetService is used to get the service by name.

type GRPC

type GRPC struct {
	URL  string `json:"url" yaml:"url"`
	Host string `json:"host" yaml:"host"`
	Port int    `json:"port" yaml:"port"`
}

GRPC is the gRPC configuration.

func (*GRPC) GetAddr

func (x *GRPC) GetAddr() string

GetAddr is used to get the gRPC address.

type Network

type Network struct {
	Name    string `json:"name" yaml:"name"`
	Testnet bool   `json:"testnet" yaml:"testnet"`
}

Network is the network configuration

Jump to

Keyboard shortcuts

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