configx

package
v0.0.0-...-ed0dbbb 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: 4 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" mapstructure:"name"`

	HTTP HTTP `json:"http" yaml:"http" mapstructure:"http"`
	GRPC GRPC `json:"grpc" yaml:"grpc" mapstructure:"grpc"`

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

	Etherscan struct {
		APIKey string `json:"api_key" yaml:"apiKey" mapstructure:"apiKey"`
	} `json:"etherscan" yaml:"etherscan" mapstructure:"etherscan"`

	Infura struct {
		ProjectID string `json:"project_id" yaml:"projectID" mapstructure:"projectID"`
	} `json:"infura" yaml:"infura" mapstructure:"infura"`
}

Application is the application configuration.

type Configx

type Configx struct {

	// Logger is the logger configuration.
	Logger logger.Options `json:"logger" yaml:"logger" mapstructure:"logger"`

	// Services is the services configuration.
	Services map[string]*Application `json:"services" yaml:"services" mapstructure:"services"`
	// contains filtered or unexported fields
}

Configx is the application configuration.

func LoadConfig

func LoadConfig(path string) (*Configx, error)

LoadConfig is used to load the configuration.

func (*Configx) GetService

func (x *Configx) 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 HTTP

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

HTTP defines the http struct.

func (*HTTP) GetAddr

func (http *HTTP) GetAddr() string

GetAddr is used to get the http address.

Jump to

Keyboard shortcuts

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