Documentation
¶
Index ¶
- Variables
- func CalledAsFromContext(ctx context.Context) string
- func Client(cfg *Config) (http.Client, error)
- func ContextWithCalledAs(ctx context.Context, calledAs string) context.Context
- func ContextWithConfig(ctx context.Context, cfg *Config) context.Context
- func IsDevVersion() bool
- func IsFreshLatestRelease(ctx context.Context) (bool, error)
- func IsUpgradeable(ctx context.Context) (bool, error)
- func NewCmd[T UIer](parent *cobra.Command, name string, fn func(*cobra.Command)) *cobra.Command
- func NewTestCmd(cmd *cobra.Command) *cobra.Command
- func ReleaseTagName() string
- func ReportError(ctx context.Context, err error, drv *ui.Driver, cmd *cobra.Command, ...)
- func UserAgent() string
- func VersionString() string
- type Clipboard
- type CmdDef
- type Config
- func (c *Config) AcmeURL(orgAPID string, realmAPID string, chainAPID string) string
- func (c *Config) Copy() *Config
- func (c *Config) GOOS() string
- func (c *Config) LclHostPort() *int
- func (c *Config) Load(ctx context.Context) error
- func (c *Config) ProcFS() fs.FS
- func (c *Config) SetupGuideURL(orgAPID string, serviceAPID string) string
- func (c *Config) SystemFS() SystemFS
- func (c *Config) Timestamp() time.Time
- func (c *Config) ViaSource(fetcher func(*Config) any) string
- func (c *Config) WriteTOML() error
- type ConfigFetchFunc
- type ConfigTest
- type ConfigTestPrefer
- type DialFunc
- type Dialer
- type Release
- type ShowHelp
- type SystemFS
- type UI
- type UIer
- type UserError
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdRoot = NewCmd[ShowHelp](nil, "anchor", func(cmd *cobra.Command) { cfg := ConfigFromCmd(cmd) cmd.PersistentFlags().StringVar(&cfg.API.Token, "api-token", Defaults.API.Token, "Anchor API personal access token (PAT).") cmd.PersistentFlags().StringVar(&cfg.API.URL, "api-url", Defaults.API.URL, "Anchor API endpoint URL.") cmd.PersistentFlags().StringVar(&cfg.File.Path, "config", Defaults.File.Path, "Service configuration file.") cmd.PersistentFlags().StringVar(&cfg.Dashboard.URL, "dashboard-url", Defaults.Dashboard.URL, "Anchor dashboard URL.") cmd.PersistentFlags().BoolVar(&cfg.File.Skip, "skip-config", Defaults.File.Skip, "Skip loading configuration file.") if err := cmd.PersistentFlags().MarkHidden("api-url"); err != nil { panic(err) } if err := cmd.PersistentFlags().MarkHidden("dashboard-url"); err != nil { panic(err) } })
View Source
var Defaults = defaultConfig()
View Source
var Executable string
View Source
var SkipReleaseCheck = false
Functions ¶
func CalledAsFromContext ¶ added in v0.1.0
func ContextWithCalledAs ¶ added in v0.1.0
func ContextWithConfig ¶ added in v0.0.21
func IsDevVersion ¶ added in v0.0.25
func IsDevVersion() bool
func IsFreshLatestRelease ¶ added in v0.1.5
func ReleaseTagName ¶ added in v0.0.25
func ReleaseTagName() string
func ReportError ¶ added in v0.0.26
func VersionString ¶ added in v0.0.25
func VersionString() string
Types ¶
type Config ¶
type Config struct {
NonInteractive bool `env:"NON_INTERACTIVE" toml:",omitempty,readonly"`
API struct {
URL string `default:"https://api.anchor.dev/v0" env:"API_URL" toml:"url,omitempty"`
Token string `env:"API_TOKEN" toml:"api-token,omitempty,readonly"`
} `toml:"api,omitempty"`
File struct {
Path string `default:"anchor.toml" env:"ANCHOR_CONFIG" toml:",omitempty,readonly"`
Skip bool `env:"ANCHOR_SKIP_CONFIG" toml:",omitempty,readonly"`
} `toml:",omitempty,readonly"`
Dashboard struct {
URL string `default:"https://anchor.dev" env:"ANCHOR_HOST" toml:"url,omitempty"`
} `toml:"dashboard,omitempty"`
Lcl struct {
LclHostURL string `default:"https://lcl.host" env:"LCL_HOST_URL" toml:",omitempty,readonly"`
RealmAPID string `env:"REALM" toml:"realm-apid,omitempty"`
Diagnostic struct {
Addr string `default:":4433" env:"DIAGNOSTIC_ADDR" toml:",omitempty"`
Subdomain string `env:"DIAGNOSTIC_SUBDOMAIN" toml:",omitempty"`
} `toml:",omitempty,readonly"`
MkCert struct {
Domains []string `flag:"domains" toml:",omitempty"`
SubCa string `flag:"subca" toml:",omitempty"`
} `toml:",omitempty,readonly"`
} `toml:"lcl-host,omitempty"`
Org struct {
APID string `env:"ORG" toml:"apid,omitempty"`
Name string `env:"ORG_NAME" toml:",omitempty,readonly"`
} `toml:"org,omitempty"`
Realm struct {
APID string `env:"REALM"`
} `toml:",omitempty,readonly"`
Service struct {
APID string `env:"SERVICE" toml:"apid,omitempty"`
Category string `env:"SERVICE_CATEGORY" toml:"category,omitempty"`
Framework string `env:"SERVICE_FRAMEWORK" toml:"framework,omitempty"`
Name string `env:"SERVICE_NAME" toml:",omitempty,readonly"`
EnvOutput string `env:"ENV_OUTPUT" toml:",omitempty,readonly"`
CertStyle string `env:"CERT_STYLE" toml:"cert-style,omitempty"`
Verify struct {
Timeout time.Duration `default:"2m" env:"VERIFY_TIMEOUT" toml:",omitempty,readonly"`
} `toml:",omitempty,readonly"`
} `toml:"service,omitempty"`
Trust struct {
NoSudo bool `flag:"no-sudo" env:"NO_SUDO" toml:",omitempty"`
MockMode bool `env:"ANCHOR_CLI_TRUSTSTORE_MOCK_MODE" toml:",omitempty"`
Stores []string `default:"[homebrew,nss,system]" env:"TRUST_STORES" toml:",omitempty"`
Clean struct {
States []string `default:"[expired]" env:"CERT_STATES" toml:",omitempty"`
} `toml:",omitempty"`
} `toml:",omitempty,readonly"`
Keyring struct {
MockMode bool `env:"ANCHOR_CLI_KEYRING_MOCK_MODE"`
} `toml:",omitempty,readonly"`
Test ConfigTest `fake:"-" toml:",omitempty,readonly"`
Via struct {
Defaults *Config `fake:"-" toml:",omitempty,readonly"`
ENV *Config `fake:"-" toml:",omitempty,readonly"`
TOML *Config `fake:"-" toml:",omitempty,readonly"`
} `toml:",omitempty,readonly"`
}
func ConfigFromCmd ¶ added in v0.0.21
func ConfigFromContext ¶ added in v0.0.21
func (*Config) LclHostPort ¶ added in v0.1.0
func (*Config) SetupGuideURL ¶ added in v0.1.0
type ConfigFetchFunc ¶ added in v0.1.2
type ConfigTest ¶ added in v0.0.36
type ConfigTest struct {
Prefer map[string]ConfigTestPrefer // values for prism prefer header
ACME struct {
URL string
}
Browserless bool // run as though browserless
GOOS string // change OS identifier in tests
ProcFS fs.FS // change the proc filesystem in tests
LclHostPort int // specify lcl host port in tests
SkipRunE bool // skip RunE for testing purposes
SystemFS SystemFS // change the system filesystem in tests
Timestamp time.Time // timestamp to use/display in tests
NetResolver *net.Resolver // DNS resolver for (some) tests
NetDialer Dialer // TCP dialer for (some) tests
}
values used for testing
type ConfigTestPrefer ¶ added in v0.0.38
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api provides primitives to interact with the openapi HTTP API.
|
Package api provides primitives to interact with the openapi HTTP API. |
|
cmd
|
|
|
anchor
command
|
|
|
internal
|
|
|
Package truststore manages local trust stores and certificates.
|
Package truststore manages local trust stores and certificates. |
Click to show internal directories.
Click to hide internal directories.
