configuration

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package configuration loads service configuration from the environment

Index

Constants

View Source
const (
	// Online specifies that outbound connections are permitted.
	Online Mode = "online"

	// Offline specifies that outbound connections are not permitted.
	Offline Mode = "offline"

	// ModeEnv specifies the environment variable read to set the Mode
	ModeEnv = "MODE"

	// NetworkEnv specifies the environment variable to read Network/ChainId from
	NetworkEnv = "NETWORK"

	// PortEnv specifies the environment variable to read server port from
	PortEnv = "PORT"

	// KavaRPCURLEnv specifies the environment variable to read server port from
	KavaRPCURLEnv = "KAVA_RPC_URL"
)

Variables

View Source
var MiddlewareVersion = "0.0.1"

MiddlewareVersion represents the kava rosetta service version

Functions

This section is empty.

Types

type ConfigLoader

type ConfigLoader interface {
	Get(key string) string
}

ConfigLoader provides an interface for loading values from a string key

type Configuration

type Configuration struct {
	Mode              Mode
	NetworkIdentifier *types.NetworkIdentifier
	Port              int
	KavaRPCURL        string
}

Configuration represents values to configure behavior of rosetta-kava and network to communicate with.

func LoadConfig

func LoadConfig(loader ConfigLoader) (*Configuration, error)

LoadConfig loads keys from a provided loader and returns a complete Configuration reference for rosetta-kava

type EnvLoader

type EnvLoader struct {
}

EnvLoader loads keys from os environment and implements ConfigLoader

func (*EnvLoader) Get

func (l *EnvLoader) Get(key string) string

Get retrieves key from os environment

type Mode

type Mode string

Mode identifies if the service is running in an 'online' or 'offline' capacity. Ref: https://www.rosetta-api.org/docs/node_deployment.html#multiple-modes

func ModeFromString

func ModeFromString(val string) (m Mode, err error)

ModeFromString returns a Mode from a string value

func (Mode) String

func (m Mode) String() string

String converts mode to string

Jump to

Keyboard shortcuts

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