config

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEmulatorConfigName = "default"

DefaultEmulatorConfigName

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

Functions

func Exists added in v0.15.0

func Exists(path string) bool

Exists checks if file exists on the specified path

func ProcessorRun added in v0.15.0

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 is main config for each account

type AccountKey

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

AccountKey is config for account key

type Accounts

type Accounts []Account

func (*Accounts) AddOrUpdate added in v0.15.0

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

AddOrUpdate add new or update if already present

func (*Accounts) GetByAddress

func (a *Accounts) GetByAddress(address string) *Account

GetByAddress get account by address

func (*Accounts) GetByName

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

GetAccountByName get account by name

type Config

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

type ConfigParsers added in v0.15.0

type ConfigParsers []Parser

ConfigParsers lsit of all configuration parsers

func (*ConfigParsers) FindForFormat added in v0.15.0

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 is config for contract

func (*Contract) IsAlias

func (c *Contract) IsAlias() bool

IsAlias checks if contract has an alias

type Contracts

type Contracts []Contract

func (*Contracts) AddOrUpdate added in v0.15.0

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 structure for contract

type Deployments

type Deployments []Deploy

func (*Deployments) AddOrUpdate added in v0.15.0

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 is config for emulator

type Emulators

type Emulators []Emulator

func (*Emulators) AddOrUpdate added in v0.15.0

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

AddOrUpdate add new or update if already present

func (*Emulators) GetDefault

func (e *Emulators) GetDefault() *Emulator

GetDefault gets default emulator

type KeyType

type KeyType string
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
)

type Loader added in v0.15.0

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

Loader contains actions for composing and modification of configuration

func NewLoader added in v0.15.0

func NewLoader(filesystem afero.Fs) *Loader

NewLoader creates a new loader

func (*Loader) AddConfigParser added in v0.15.0

func (l *Loader) AddConfigParser(format Parser)

AddConfigParser adds new parssers for configuration

func (*Loader) Load added in v0.15.0

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

Load and compose multiple configurations

func (*Loader) Save added in v0.15.0

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

Save save configuration to a path with correct serializer

type Network

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

Network config sets host and chain id

type Networks

type Networks []Network

func (*Networks) AddOrUpdate added in v0.15.0

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 added in v0.15.0

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