utils

package
v0.0.0-...-cda998f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMultihash

func CreateMultihash(bytes []byte) ([]byte, error)

CreateMultihash creates a multihash given bytes

func IntOrEmptyInt

func IntOrEmptyInt(s *int) int

IntOrEmptyInt returns an empty int if a int pointer is nil. Otherwise returns the int value of the pointer.

func IntToPtr

func IntToPtr(s int) *int

IntToPtr is a convenience func that converts a int to it's pointer

func MultiHashString

func MultiHashString(str string) (string, error)

MultiHashString create a multihash hex from a string

func StrOrEmptyStr

func StrOrEmptyStr(s *string) string

StrOrEmptyStr returns an empty string if a string pointer is nil. Otherwise returns the string value of the pointer.

func StrToPtr

func StrToPtr(s string) *string

StrToPtr is a convenience func that converts a string to it's pointer

Types

type AnyValue

type AnyValue struct {
	Value interface{}
}

AnyValue is a GraphQL scalar to represent either a string or a map

func (AnyValue) MarshalGQL

func (a AnyValue) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface

func (*AnyValue) UnmarshalGQL

func (a *AnyValue) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface

type IDHubConfig

type IDHubConfig struct {
	GqlPort                   int    `required:"true" desc:"Sets the ID Hub GraphQL port"`
	RootCommitsAddress        string `required:"true" split_words:"true" desc:"address where root commits are stored"`
	EthereumDefaultPrivateKey string `required:"true" split_words:"true" desc:"Private key to use when sending Ethereum transactions"`
	EthAPIURL                 string `required:"true" envconfig:"eth_api_url" desc:"Ethereum API address"`

	CronConfig string `envconfig:"cron_config" desc:"Cron config string * * * * *"`

	PersisterType             ccfg.PersisterType `ignored:"true"`
	PersisterTypeName         string             `split_words:"true" required:"true" desc:"Sets the persister type to use"`
	PersisterPostgresAddress  string             `split_words:"true" desc:"If persister type is Postgresql, sets the address"`
	PersisterPostgresPort     int                `split_words:"true" desc:"If persister type is Postgresql, sets the port"`
	PersisterPostgresDbname   string             `split_words:"true" desc:"If persister type is Postgresql, sets the database name"`
	PersisterPostgresUser     string             `split_words:"true" desc:"If persister type is Postgresql, sets the database user"`
	PersisterPostgresPw       string             `split_words:"true" desc:"If persister type is Postgresql, sets the database password"`
	PersisterPostgresMaxConns *int               `split_words:"true" desc:"If persister type is Postgresql, sets the max conns in pool"`
	PersisterPostgresMaxIdle  *int               `split_words:"true" desc:"If persister type is Postgresql, sets the max idle conns in pool"`
	PersisterPostgresConnLife *int               `split_words:"true" desc:"If persister type is Postgresql, sets the max conn lifetime in secs"`

	RedisHosts []string `split_words:"true" desc:"List of Redis host:port for caching and locking"`

	NatsPersisterDriver string `split_words:"true" desc:"the driver for nats persistence"`
	NatsID              string `envconfig:"nats_id" desc:"the id of the nats server"`
	NatsPrefix          string `split_words:"true" desc:"the prefix for every nats message"`

	DidUniversalResolverHost *string `split_words:"true" desc:"Sets the host for the universal DID resolver"`
	DidUniversalResolverPort *int    `split_words:"true" desc:"Sets the port for the universal DID resolver"`
}

IDHubConfig is the master config for the ID Hub API derived from environment variables.

func (*IDHubConfig) OutputUsage

func (c *IDHubConfig) OutputUsage()

OutputUsage prints the usage string to os.Stdout

func (*IDHubConfig) PopulateFromEnv

func (c *IDHubConfig) PopulateFromEnv() error

PopulateFromEnv processes the environment vars, populates config with the respective values, and validates the values.

Jump to

Keyboard shortcuts

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