config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTypeHex                        KeyType = "hex"        // Hex private key with in memory signer
	KeyTypeGoogleKMS                  KeyType = "google-kms" // Google KMS signer
	KeyTypeShell                      KeyType = "shell"      // Exec out to a shell script
	DefaultEmulatorConfigName                 = "default"
	PrivateKeyField                           = "privateKey"
	KMSContextField                           = "resourceName"
	DefaultEmulatorServiceAccountName         = "emulator-account"
)

Variables

View Source
var ErrDoesNotExist = errors.New("project config file does not exist")

ErrDoesNotExist is error to be returned when config file does not exists

View Source
var ErrOutdatedFormat = errors.New("you are using old configuration format")

Functions

func Exists

func Exists(path string) bool

Exists checks if file exists on the specified path

func ProcessorRun

func ProcessorRun(raw []byte) ([]byte, map[string]string)

ProcessorRun all pre-processors

Types

type Account

type Account struct {
	Name    string
	Address flow.Address
	ChainID flow.ChainID
	Keys    []AccountKey
}

Account defines the configuration for a Flow account.

type AccountKey

type AccountKey struct {
	Type     KeyType
	Index    int
	SigAlgo  crypto.SignatureAlgorithm
	HashAlgo crypto.HashAlgorithm
	Context  map[string]string
}

AccountKey defines the configuration for a Flow account key.

type Accounts

type Accounts []Account

func (*Accounts) AddOrUpdate

func (a *Accounts) AddOrUpdate(name string, account Account)

AddOrUpdate add new or update if already present

func (*Accounts) GetByName

func (a *Accounts) GetByName(name string) *Account

AccountByName get account by name

type Config

type Config struct {
	Emulators   Emulators
	Contracts   Contracts
	Networks    Networks
	Accounts    Accounts
	Deployments Deployments
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig gets default configuration

type ConfigParsers

type ConfigParsers []Parser

ConfigParsers is a list of all configuration parsers.

func (*ConfigParsers) FindForFormat

func (c *ConfigParsers) FindForFormat(extension string) Parser

FindForFormat finds a parser that can parse a specific format based on extension

type Contract

type Contract struct {
	Name    string
	Source  string
	Network string
	Alias   string
}

Contract defines the configuration for a Cadence contract.

func (*Contract) IsAlias

func (c *Contract) IsAlias() bool

IsAlias checks if contract has an alias

type Contracts

type Contracts []Contract

func (*Contracts) AddOrUpdate

func (c *Contracts) AddOrUpdate(name string, contract Contract)

AddOrUpdate add new or update if already present

func (*Contracts) GetByName

func (c *Contracts) GetByName(name string) *Contract

GetByName get contract by name

func (*Contracts) GetByNameAndNetwork

func (c *Contracts) GetByNameAndNetwork(name string, network string) *Contract

GetByNameAndNetwork get contract array for account and network

func (*Contracts) GetByNetwork

func (c *Contracts) GetByNetwork(network string) Contracts

GetByNetwork returns all contracts for specific network

type Deploy

type Deploy struct {
	Network   string   // network name to deploy to
	Account   string   // account name to which to deploy to
	Contracts []string // contracts names to deploy
}

Deploy defines the configuration for a contract deployment.

type Deployments

type Deployments []Deploy

func (*Deployments) AddOrUpdate

func (d *Deployments) AddOrUpdate(deployment Deploy)

AddOrUpdate add new or update if already present

func (*Deployments) GetByAccountAndNetwork

func (d *Deployments) GetByAccountAndNetwork(account string, network string) []Deploy

GetByAccountAndNetwork get deploy by account and network

func (*Deployments) GetByNetwork

func (d *Deployments) GetByNetwork(network string) Deployments

GetByNetwork get all deployments by network

type Emulator

type Emulator struct {
	Name           string
	Port           int
	ServiceAccount string
}

Emulator defines the configuration for a Flow Emulator instance.

func DefaultEmulator

func DefaultEmulator() Emulator

DefaultEmulator gets default emulator

type Emulators

type Emulators []Emulator

func DefaultEmulators

func DefaultEmulators() Emulators

DefaultEmulators gets all default emulators

func (*Emulators) AddOrUpdate

func (e *Emulators) AddOrUpdate(name string, emulator Emulator)

AddOrUpdate add new or update if already present

func (*Emulators) Default

func (e *Emulators) Default() *Emulator

Default gets default emulator

type KeyType

type KeyType string

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader contains actions for composing and modifying configuration.

func NewLoader

func NewLoader(filesystem afero.Fs) *Loader

NewLoader returns a new loader.

func (*Loader) AddConfigParser

func (l *Loader) AddConfigParser(format Parser)

AddConfigParser adds a new configuration parser.

func (*Loader) Load

func (l *Loader) Load(paths []string) (*Config, error)

Load loads configuration from one or more file paths.

If more than one path is specified, their contents are merged together into on configuration object.

func (*Loader) Save

func (l *Loader) Save(conf *Config, path string) error

Save saves a configuration to a path with correct serializer

type Network

type Network struct {
	Name    string
	Host    string
	ChainID flow.ChainID
}

Network defines the configuration for a Flow network.

func DefaultEmulatorNetwork

func DefaultEmulatorNetwork() Network

DefaultEmulatorNetwork get default emulator network

func DefaultMainnetNetwork

func DefaultMainnetNetwork() Network

DefaultMainnetNetwork get default mainnet network

func DefaultTestnetNetwork

func DefaultTestnetNetwork() Network

DefaultTestnetNetwork get default testnet network

type Networks

type Networks []Network

func DefaultNetworks

func DefaultNetworks() Networks

DefaultNetworks gets all default networks

func (*Networks) AddOrUpdate

func (n *Networks) AddOrUpdate(name string, network Network)

AddOrUpdate add new network or update if already present

func (*Networks) GetByName

func (n *Networks) GetByName(name string) *Network

GetByName get network by name

type Parser

type Parser interface {
	Serialize(*Config) ([]byte, error)
	Deserialize([]byte) (*Config, error)
	SupportsFormat(string) bool
}

Parser is interface for any configuration format parser to implement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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