common

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASCIIBanner = `` /* 853-byte string literal not displayed */

	// Viper downcases key names, so hyphenating for better readability.
	// 'Partial' keys are to be combined with the application ID they are associated with.
	// and NOT used by themselves.
	AuthTokenConfigKey              = "auth-token"        // user-scoped API token key
	APIAccessTokenConfigKeyPartial  = "api-token"         // app- or org-scoped API token key
	APIRefreshTokenConfigKeyPartial = "api-refresh-token" // app- or org-scoped API token key
	AccountConfigKeyPartial         = "account"           // app-scoped account ID key
	OrganizationConfigKeyPartial    = "organization"      // app-scoped organization ID key
	WalletConfigKeyPartial          = "wallet"            // app-scoped HD wallet ID key
)
View Source
const InfrastructureTargetAWS = "aws"
View Source
const InfrastructureTargetAzure = "azure"

Variables

View Source
var (
	Application   *ident.Application
	ApplicationID string

	OrganizationID string
	Organization   *ident.Organization

	UserID string
	User   *ident.User

	AccountID   string
	ConnectorID string
	ContractID  string
	NetworkID   string
	NodeID      string
	WalletID    string

	Verbose bool
)
View Source
var (
	EngineID           string
	ProviderID         string
	Region             string
	TargetID           string
	Image              string
	HealthCheckPath    string
	TaskRole           string
	TCPIngressPorts    string
	UDPIngressPorts    string
	AWSAccessKeyID     string
	AWSSecretAccessKey string
	AzureTenantID      string
	AzureClientID      string
	AzureClientSecret  string
)
View Source
var APIEndpoint string
View Source
var ApplicationAccessToken string
View Source
var CfgFile string
View Source
var ExposeAPITunnel bool
View Source
var ExposeMessagingTunnel bool
View Source
var MessagingEndpoint string
View Source
var OrganizationAccessToken string
View Source
var OrganizationRefreshToken string
View Source
var ResolvedBaselineOrgAddress string // HACK
View Source
var Tunnel bool
View Source
var VaultID string

Functions

func AuthorizeApplicationContext

func AuthorizeApplicationContext()

func AuthorizeOrganizationContext

func AuthorizeOrganizationContext(persist bool)

func BuildConfigKeyWithApp

func BuildConfigKeyWithApp(keyPartial, appID string) string

BuildConfigKeyWithApp combines the given key partial and app ID according to a consistent convention. Returns an empty string if the given appID is empty. Viper's getters likewise return empty strings when passed an empty string.

func BuildConfigKeyWithOrg

func BuildConfigKeyWithOrg(keyPartial, orgID string) string

BuildConfigKeyWithOrg combines the given key partial and org ID according to a consistent convention. Returns an empty string if the given orgID is empty. Viper's getters likewise return empty strings when passed an empty string.

func BuildConfigKeyWithUser

func BuildConfigKeyWithUser(keyPartial, userID string) string

BuildConfigKeyWithUser combines the given key partial and user ID according to a consistent convention. Returns an empty string if the given userID is empty. Viper's getters likewise return empty strings when passed an empty string.

func CacheCommands

func CacheCommands(cmd *cobra.Command)

func CmdExists

func CmdExists(cmd *cobra.Command, args []string) (bool, string)

func CmdExistsOrExit

func CmdExistsOrExit(cmd *cobra.Command, args []string)

func EtherscanBaseURL

func EtherscanBaseURL(networkID string) *string

func FreeInput

func FreeInput(label string, defaultValue string, validation string) string

func InfrastructureCredentialsConfigFactory

func InfrastructureCredentialsConfigFactory() map[string]interface{}

func InitConfig

func InitConfig()

initConfig reads in config file and ENV variables if set.

func InitWorkgroupContract

func InitWorkgroupContract() *nchain.Contract

func RegisterWorkgroupOrganization

func RegisterWorkgroupOrganization(applicationID string)

func RequireAPIToken

func RequireAPIToken() string

func RequireAccount

func RequireAccount(params map[string]interface{}) error

RequireAccount is equivalent to a required --account flag

func RequireApplication

func RequireApplication() error

RequireApplication is equivalent to a required --application flag

func RequireApplicationToken

func RequireApplicationToken() string

func RequireConnector

func RequireConnector(params map[string]interface{}) error

RequireConnector is equivalent to a required --connector flag

func RequireContract

func RequireContract(contractID, contractType *string, printCreationTxLink bool) error

func RequireInfrastructureFlags

func RequireInfrastructureFlags(cmd *cobra.Command, withImage bool)

func RequireNetwork

func RequireNetwork() error

RequireNetwork is equivalent to a required --network flag

func RequireOrganization

func RequireOrganization() error

RequireOrganization is equivalent to a required --organization flag

func RequireOrganizationEndpoints

func RequireOrganizationEndpoints(fn func(), apiPort, messagingPort int)

RequireOrganizationEndpoints fn is the function to call after the tunnel has been established, prior to the runloop and signal handling is installed

func RequireOrganizationKeypair

func RequireOrganizationKeypair(spec string) (*vault.Key, error)

func RequireOrganizationToken

func RequireOrganizationToken() string

func RequireOrganizationVault

func RequireOrganizationVault()

func RequirePublicNetwork

func RequirePublicNetwork() error

RequirePublicNetwork is equivalent to a required --network flag; but list options filtered to show only public networks

func RequireUserAuthToken

func RequireUserAuthToken() string

func RequireVault

func RequireVault() error

RequireVault is equivalent to a required --vault flag

func RequireWallet

func RequireWallet() error

RequireWallet is equivalent to a required --wallet flag

func RequireWorkgroup

func RequireWorkgroup() error

RequireWorkgroup is equivalent to a required --workgroup flag (yes, this is identical to RequireApplication() with exception to the Printf content...)

func ResolveCapabilities

func ResolveCapabilities() (map[string]interface{}, error)

func SelectInput

func SelectInput(args []string, label string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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