Documentation
¶
Overview ¶
Package config defines all the variables that users can set (through flags, environment vars, or the config file) to affect command behavior.
The variables are grouped into a hierarchy of structs that matches the subcommand tree. Each struct defines destination fields and the mapping from command-specific flags into those fields.
These structs are defined in a separate package from the actual behavior (in the 'internal/command' package) so that nested commands can refer to the "inherited" config from parent commands without creating an import loop.
Index ¶
- Constants
- Variables
- func GetLocaldPIDfile(signadotDir string, isRootManager bool) string
- func InitViper(configFile string) error
- type API
- func (a *API) APIClientWithCustomTransport(conf *transport.APIConfig, execute func(client *client.SignadotAPI) error) error
- func (a *API) GetBaseTransport() *transport.APIConfig
- func (a *API) GetBearerToken() (string, error)
- func (a *API) InitAPIConfig() error
- func (a *API) InitAPIConfigWithApiKey(apiKey string) error
- func (a *API) InitAPIConfigWithBearerToken(bearerToken string) error
- func (a *API) InitAPITransport() error
- func (a *API) InitUnauthAPIConfig() error
- func (a *API) MarshalJSON() ([]byte, error)
- func (a *API) MarshalYAML() ([]byte, error)
- func (a *API) RefreshAPIConfig() error
- type Artifact
- type ArtifactDownload
- type Auth
- type AuthLogin
- type AuthLogout
- type AuthStatus
- type Cluster
- type ClusterAdd
- type ClusterDevMesh
- type ClusterDevMeshAnalyze
- type ClusterList
- type ClusterToken
- type ClusterTokenCreate
- type ClusterTokenDelete
- type ClusterTokenList
- type ConnectInvocationConfig
- type ConnectInvocationUser
- type ConnectWait
- type Devbox
- type DevboxDelete
- type DevboxList
- type DevboxRegister
- type HostedTest
- type HostedTestApply
- type HostedTestDelete
- type HostedTestGet
- type HostedTestList
- type HostedTestRun
- type Job
- type JobDelete
- type JobGet
- type JobList
- type JobRunnerGroup
- type JobRunnerGroupApply
- type JobRunnerGroupDelete
- type JobRunnerGroupGet
- type JobRunnerGroupList
- type JobSubmit
- type Local
- type LocalConnect
- type LocalDaemon
- type LocalDisconnect
- type LocalOverride
- type LocalOverrideCreate
- type LocalOverrideDelete
- type LocalOverrideList
- type LocalProxy
- type LocalStatus
- type Logs
- type MCP
- type OutputFormat
- type ProxyMapping
- type ResourcePlugin
- type ResourcePluginApply
- type ResourcePluginDelete
- type ResourcePluginGet
- type ResourcePluginList
- type Root
- type RouteGroup
- type RouteGroupApply
- type RouteGroupDelete
- type RouteGroupGet
- type RouteGroupList
- type Sandbox
- type SandboxApply
- type SandboxCleanFiles
- type SandboxDelete
- type SandboxGet
- type SandboxGetEnv
- type SandboxGetFiles
- type SandboxList
- type SmartTest
- type SmartTestExec
- type SmartTestExecCancel
- type SmartTestExecGet
- type SmartTestExecList
- type SmartTestList
- type SmartTestRun
- type TemplateVal
- type TemplateVals
- type TestExecLabels
- type Traffic
- type TrafficInspect
- type TrafficWatch
Constants ¶
const ( RootManagerPIDFile = "rootmanager.pid" SandboxManagerPIDFile = "sandboxmanager.pid" RootManagerLogFile = "root-manager.log" SandboxManagerLogFile = "sandbox-manager.log" )
const (
DefaultVirtualIPNet = "242.242.0.1/16"
)
Variables ¶
var ( ErrAuthExpired = errors.New("Authentication expired. Please log in using 'signadot auth login'") ErrAuthNoOrgFound = errors.New("No organisation found. Please log in using 'signadot auth login'") ErrAuthNoFound = errors.New("No authentication found. Please log in using 'signadot auth login'") )
var (
VarRx = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_.-]*$`)
)
Functions ¶
func GetLocaldPIDfile ¶ added in v1.4.0
Types ¶
type API ¶ added in v0.3.3
type API struct {
Root
// Config file values
Org string
MaskedAPIKey string
APIURL string
ArtifactsAPIURL string
ProxyURL string
MCPURL string
// Runtime values
Client *client.SignadotAPI `json:"-"`
ApiKey string
BearerToken string
UserAgent string
}
func (*API) APIClientWithCustomTransport ¶ added in v0.8.0
func (*API) GetBaseTransport ¶ added in v0.8.0
func (*API) GetBearerToken ¶ added in v1.5.0
GetBearerToken initializes the API config (refreshing the token if needed) and returns the bearer token. Returns an error if the user is authenticated with an API key instead.
func (*API) InitAPIConfig ¶ added in v0.3.3
func (*API) InitAPIConfigWithApiKey ¶ added in v0.9.1
func (*API) InitAPIConfigWithBearerToken ¶ added in v0.9.1
func (*API) InitAPITransport ¶ added in v0.5.0
func (*API) InitUnauthAPIConfig ¶ added in v0.9.1
func (*API) MarshalJSON ¶ added in v0.3.3
for error reporting, we select the config that the user controls.
func (*API) MarshalYAML ¶ added in v0.5.0
func (*API) RefreshAPIConfig ¶ added in v1.3.0
RefreshAPIConfig refreshes the API config by re-initializing the API client
type ArtifactDownload ¶ added in v0.8.0
func (*ArtifactDownload) AddFlags ¶ added in v0.8.0
func (c *ArtifactDownload) AddFlags(cmd *cobra.Command)
type AuthLogout ¶ added in v0.9.1
type AuthLogout struct {
*Auth
}
type AuthStatus ¶ added in v0.9.1
type AuthStatus struct {
*Auth
}
type ClusterAdd ¶ added in v0.2.0
func (*ClusterAdd) AddFlags ¶ added in v0.2.0
func (c *ClusterAdd) AddFlags(cmd *cobra.Command)
type ClusterDevMesh ¶ added in v1.1.0
type ClusterDevMesh struct {
*Cluster
}
type ClusterDevMeshAnalyze ¶ added in v1.1.0
type ClusterDevMeshAnalyze struct {
*ClusterDevMesh
// Flags
ClusterName string
Namespace string
Status string
}
func (*ClusterDevMeshAnalyze) AddFlags ¶ added in v1.1.0
func (c *ClusterDevMeshAnalyze) AddFlags(cmd *cobra.Command)
type ClusterList ¶
type ClusterList struct {
*Cluster
}
type ClusterToken ¶
type ClusterToken struct {
*Cluster
}
type ClusterTokenCreate ¶
type ClusterTokenCreate struct {
*ClusterToken
// Flags
ClusterName string
}
func (*ClusterTokenCreate) AddFlags ¶
func (c *ClusterTokenCreate) AddFlags(cmd *cobra.Command)
type ClusterTokenDelete ¶ added in v0.2.0
type ClusterTokenDelete struct {
*ClusterToken
// Flags
ClusterName string
}
func (*ClusterTokenDelete) AddFlags ¶ added in v0.2.0
func (c *ClusterTokenDelete) AddFlags(cmd *cobra.Command)
type ClusterTokenList ¶ added in v0.2.0
type ClusterTokenList struct {
*ClusterToken
// Flags
ClusterName string
}
func (*ClusterTokenList) AddFlags ¶ added in v0.2.0
func (c *ClusterTokenList) AddFlags(cmd *cobra.Command)
type ConnectInvocationConfig ¶ added in v0.5.0
type ConnectInvocationConfig struct {
WithRootManager bool `json:"withRootManager"`
APIPort uint16 `json:"apiPort"`
LocalNetPort uint16 `json:"localNetPort"`
SignadotDir string `json:"signadotDir"`
User *ConnectInvocationUser `json:"user"`
Env []string `json:"env"`
VirtualIPNet string `json:"virtualIPNet"`
ConnectionConfig *connectcfg.ConnectionConfig `json:"connectionConfig"`
ProxyURL string `json:"proxyURL"`
APIURL string `json:"apiURL"`
APIKey string `json:"apiKey"`
ConfigFile string `json:"configFile"`
Debug bool `json:"debug"`
ConnectTimeout string `json:"connectTimeout"`
DevboxID string `json:"devboxID"`
DevboxSessionID string `json:"devboxSessionID"`
}
ConnectInvocationConfig is the config for locald as computed by `signadot local connect` when `signadot local connect` is called. This prevents racy behavior when the config file is edited, allows config to be computed by non-root user and used subsequently by root, and facilitates wrapping everything that needs to be passed in a json so we can evolve what needs to be passed without plumbing the command line
func (*ConnectInvocationConfig) GetLogName ¶ added in v0.5.0
func (ciConfig *ConnectInvocationConfig) GetLogName(isRootManager bool) string
func (*ConnectInvocationConfig) GetPIDfile ¶ added in v0.5.0
func (ciConfig *ConnectInvocationConfig) GetPIDfile(isRootManager bool) string
type ConnectInvocationUser ¶ added in v0.5.0
type ConnectWait ¶ added in v0.7.0
type ConnectWait int
const ( ConnectWaitConnect ConnectWait = iota ConnectWaitSandboxes ConnectWaitNone )
func ParseConnectWait ¶ added in v0.7.0
func ParseConnectWait(v string) (ConnectWait, error)
func (*ConnectWait) Set ¶ added in v0.7.0
func (cw *ConnectWait) Set(v string) error
func (ConnectWait) String ¶ added in v0.7.0
func (cw ConnectWait) String() string
func (*ConnectWait) Type ¶ added in v0.7.0
func (cw *ConnectWait) Type() string
type Devbox ¶ added in v1.4.0
type Devbox struct {
*API
}
Devbox contains configuration for devbox commands.
type DevboxDelete ¶ added in v1.4.0
DevboxDelete contains configuration for deleting a devbox.
func (*DevboxDelete) AddFlags ¶ added in v1.4.0
func (c *DevboxDelete) AddFlags(cmd *cobra.Command)
AddFlags adds flags for devbox delete command.
type DevboxList ¶ added in v1.4.0
DevboxList contains configuration for listing devboxes.
func (*DevboxList) AddFlags ¶ added in v1.4.0
func (c *DevboxList) AddFlags(cmd *cobra.Command)
AddFlags adds flags for devbox list command.
type DevboxRegister ¶ added in v1.4.0
DevboxRegister contains configuration for registering a devbox.
func (*DevboxRegister) AddFlags ¶ added in v1.4.0
func (c *DevboxRegister) AddFlags(cmd *cobra.Command)
AddFlags adds flags for devbox register command.
type HostedTest ¶ added in v0.9.0
type HostedTest struct {
*API
}
type HostedTestApply ¶ added in v0.9.0
type HostedTestApply struct {
*HostedTest
Filename string
TemplateVals TemplateVals
}
func (*HostedTestApply) AddFlags ¶ added in v0.9.0
func (cfg *HostedTestApply) AddFlags(cmd *cobra.Command)
type HostedTestDelete ¶ added in v0.9.0
type HostedTestDelete struct {
*HostedTest
Filename string
TemplateVals TemplateVals
}
type HostedTestGet ¶ added in v0.9.0
type HostedTestGet struct {
*HostedTest
}
type HostedTestList ¶ added in v0.9.0
type HostedTestList struct {
*HostedTest
}
type HostedTestRun ¶ added in v0.9.0
type HostedTestRun struct {
*HostedTest
Cluster string
Sandbox string
RouteGroup string
}
func (*HostedTestRun) AddFlags ¶ added in v0.9.0
func (cfg *HostedTestRun) AddFlags(cmd *cobra.Command)
type JobRunnerGroup ¶ added in v0.8.0
type JobRunnerGroup struct {
*API
}
type JobRunnerGroupApply ¶ added in v0.8.0
type JobRunnerGroupApply struct {
*JobRunnerGroup
// Flags
Filename string
TemplateVals TemplateVals
}
func (*JobRunnerGroupApply) AddFlags ¶ added in v0.8.0
func (c *JobRunnerGroupApply) AddFlags(cmd *cobra.Command)
type JobRunnerGroupDelete ¶ added in v0.8.0
type JobRunnerGroupDelete struct {
*JobRunnerGroup
// Flags
Filename string
TemplateVals TemplateVals
}
func (*JobRunnerGroupDelete) AddFlags ¶ added in v0.8.0
func (c *JobRunnerGroupDelete) AddFlags(cmd *cobra.Command)
type JobRunnerGroupGet ¶ added in v0.8.0
type JobRunnerGroupGet struct {
*JobRunnerGroup
}
type JobRunnerGroupList ¶ added in v0.8.0
type JobRunnerGroupList struct {
*JobRunnerGroup
}
type JobSubmit ¶ added in v0.8.0
type Local ¶ added in v0.5.0
type Local struct {
*API
// initialized from ~/.signadot/config.yaml
LocalConfig *config.Config
// hidden
GOPSAddrRoot string
GOPSAddrNonRoot string
}
func (*Local) GetConnectionConfig ¶ added in v0.5.0
func (l *Local) GetConnectionConfig(cluster string) (*config.ConnectionConfig, error)
func (*Local) InitLocalConfig ¶ added in v0.5.0
type LocalConnect ¶ added in v0.5.0
type LocalConnect struct {
*Local
// Flags
Cluster string
Unprivileged bool
Wait ConnectWait
WaitTimeout time.Duration
// Hidden Flags
DumpCIConfig bool
PProfAddr string
Devbox string
}
func (*LocalConnect) AddFlags ¶ added in v0.5.0
func (c *LocalConnect) AddFlags(cmd *cobra.Command)
type LocalDaemon ¶ added in v0.5.0
type LocalDaemon struct {
// config sent from `signadot local connect` in $SIGNADOT_LOCAL_CONNECT_CONFIG
ConnectInvocationConfig *ConnectInvocationConfig
// Flags
DaemonRun bool
RootManager bool
SandboxManager bool
// Hidden Flags
ConnectInvocationConfigFile string
PProfAddr string
GOPSAddrRoot string
GOPSAddrNonRoot string
}
func (*LocalDaemon) AddFlags ¶ added in v0.5.0
func (ld *LocalDaemon) AddFlags(cmd *cobra.Command)
func (*LocalDaemon) InitLocalDaemon ¶ added in v0.5.0
func (ld *LocalDaemon) InitLocalDaemon() error
type LocalDisconnect ¶ added in v0.5.0
func (*LocalDisconnect) AddFlags ¶ added in v0.6.0
func (c *LocalDisconnect) AddFlags(cmd *cobra.Command)
type LocalOverride ¶ added in v1.3.0
type LocalOverride struct {
*Local
}
type LocalOverrideCreate ¶ added in v1.3.0
type LocalOverrideCreate struct {
*LocalOverride
// Flags
Sandbox string
Port int64
To string
Workload string
Detach bool
// Policy
ExcludedStatusCodes []int `json:"excludedStatusCodes"`
WaitTimeout time.Duration
}
func (*LocalOverrideCreate) AddFlags ¶ added in v1.3.0
func (lo *LocalOverrideCreate) AddFlags(cmd *cobra.Command)
func (*LocalOverrideCreate) Validate ¶ added in v1.3.0
func (lo *LocalOverrideCreate) Validate() error
type LocalOverrideDelete ¶ added in v1.3.0
type LocalOverrideDelete struct {
*LocalOverride
// Flags
Sandbox string
}
func (*LocalOverrideDelete) AddFlags ¶ added in v1.3.0
func (lod *LocalOverrideDelete) AddFlags(cmd *cobra.Command)
type LocalOverrideList ¶ added in v1.3.0
type LocalOverrideList struct {
*LocalOverride
}
type LocalProxy ¶ added in v0.7.0
type LocalProxy struct {
*Local
// Flags
Sandbox string
RouteGroup string
Cluster string
ProxyMappings []ProxyMapping
// Hidden Flags
PProfAddr string
}
func (*LocalProxy) AddFlags ¶ added in v0.7.0
func (lp *LocalProxy) AddFlags(cmd *cobra.Command)
func (*LocalProxy) Validate ¶ added in v0.7.0
func (lp *LocalProxy) Validate() error
type LocalStatus ¶ added in v0.5.0
func (*LocalStatus) AddFlags ¶ added in v0.5.0
func (c *LocalStatus) AddFlags(cmd *cobra.Command)
type OutputFormat ¶
type OutputFormat string
const ( OutputFormatDefault OutputFormat = "" OutputFormatYAML OutputFormat = "yaml" OutputFormatJSON OutputFormat = "json" )
func (*OutputFormat) Set ¶
func (o *OutputFormat) Set(v string) error
Set implements the pflag.Value interface.
func (*OutputFormat) String ¶
func (o *OutputFormat) String() string
func (*OutputFormat) Type ¶
func (o *OutputFormat) Type() string
Type implements the pflag.Value interface.
type ProxyMapping ¶ added in v0.7.0
func (*ProxyMapping) GetTarget ¶ added in v0.7.0
func (pm *ProxyMapping) GetTarget() string
func (*ProxyMapping) String ¶ added in v0.7.0
func (pm *ProxyMapping) String() string
func (*ProxyMapping) Validate ¶ added in v0.7.0
func (pm *ProxyMapping) Validate() error
type ResourcePlugin ¶ added in v0.4.0
type ResourcePlugin struct {
*API
}
type ResourcePluginApply ¶ added in v0.4.0
type ResourcePluginApply struct {
*ResourcePlugin
// Flags
Filename string
TemplateVals TemplateVals
}
func (*ResourcePluginApply) AddFlags ¶ added in v0.4.0
func (c *ResourcePluginApply) AddFlags(cmd *cobra.Command)
type ResourcePluginDelete ¶ added in v0.4.0
type ResourcePluginDelete struct {
*ResourcePlugin
// Flags
Filename string
TemplateVals TemplateVals
}
func (*ResourcePluginDelete) AddFlags ¶ added in v0.4.0
func (c *ResourcePluginDelete) AddFlags(cmd *cobra.Command)
type ResourcePluginGet ¶ added in v0.4.0
type ResourcePluginGet struct {
*ResourcePlugin
}
type ResourcePluginList ¶ added in v0.4.0
type ResourcePluginList struct {
*ResourcePlugin
}
type Root ¶
type Root struct {
// Config file values
DashboardURL *url.URL
// Flags
Debug bool
ConfigFile string
OutputFormat OutputFormat
}
func (*Root) RunnerGroupDashboardUrl ¶ added in v0.8.0
type RouteGroup ¶ added in v0.3.7
type RouteGroup struct {
*API
}
type RouteGroupApply ¶ added in v0.3.7
type RouteGroupApply struct {
*RouteGroup
// Flags
Filename string
Wait bool
WaitTimeout time.Duration
TemplateVals TemplateVals
}
func (*RouteGroupApply) AddFlags ¶ added in v0.3.7
func (c *RouteGroupApply) AddFlags(cmd *cobra.Command)
type RouteGroupDelete ¶ added in v0.3.7
type RouteGroupDelete struct {
*RouteGroup
// Flags
Filename string
Wait bool
WaitTimeout time.Duration
TemplateVals TemplateVals
}
func (*RouteGroupDelete) AddFlags ¶ added in v0.3.7
func (c *RouteGroupDelete) AddFlags(cmd *cobra.Command)
type RouteGroupGet ¶ added in v0.3.7
type RouteGroupGet struct {
*RouteGroup
}
type RouteGroupList ¶ added in v0.3.7
type RouteGroupList struct {
*RouteGroup
}
type SandboxApply ¶ added in v0.2.0
type SandboxApply struct {
*Sandbox
// Flags
Filename string
Wait bool
WaitTimeout time.Duration
TemplateVals TemplateVals
}
func (*SandboxApply) AddFlags ¶ added in v0.2.0
func (c *SandboxApply) AddFlags(cmd *cobra.Command)
type SandboxCleanFiles ¶ added in v1.0.0
type SandboxCleanFiles struct {
*Sandbox
}
type SandboxDelete ¶
type SandboxDelete struct {
*Sandbox
// Flags
Filename string
Wait bool
WaitTimeout time.Duration
TemplateVals TemplateVals
Force bool
}
func (*SandboxDelete) AddFlags ¶
func (c *SandboxDelete) AddFlags(cmd *cobra.Command)
type SandboxGet ¶
type SandboxGet struct {
*Sandbox
}
type SandboxGetEnv ¶ added in v1.0.0
func (*SandboxGetEnv) AddFlags ¶ added in v1.0.0
func (c *SandboxGetEnv) AddFlags(cmd *cobra.Command)
type SandboxGetFiles ¶ added in v1.0.0
type SandboxGetFiles struct {
*Sandbox
Local string
Container string
OutputDir string
NoClobber bool
}
func (*SandboxGetFiles) AddFlags ¶ added in v1.0.0
func (c *SandboxGetFiles) AddFlags(cmd *cobra.Command)
type SandboxList ¶
type SandboxList struct {
*Sandbox
}
type SmartTest ¶ added in v0.9.0
type SmartTest struct {
*API
}
SmartTest represents the configuration for the test command
type SmartTestExec ¶ added in v0.9.0
type SmartTestExec struct {
*SmartTest
}
type SmartTestExecCancel ¶ added in v0.9.0
type SmartTestExecCancel struct {
*SmartTestExec
RunID string
}
func (*SmartTestExecCancel) AddFlags ¶ added in v0.9.0
func (c *SmartTestExecCancel) AddFlags(cmd *cobra.Command)
type SmartTestExecGet ¶ added in v0.9.0
type SmartTestExecGet struct {
*SmartTestExec
}
type SmartTestExecList ¶ added in v0.9.0
type SmartTestExecList struct {
*SmartTestExec
TestName string
RunID string
Sandbox string
Repo string
RepoPath string
RepoCommitSHA string
ExecutionPhase string
Labels TestExecLabels
}
func (*SmartTestExecList) AddFlags ¶ added in v0.9.0
func (c *SmartTestExecList) AddFlags(cmd *cobra.Command)
type SmartTestList ¶ added in v0.9.1
type SmartTestList struct {
*SmartTest
Directory string
File string
FilterLabels TestExecLabels
WithoutLabels TestExecLabels
}
func (*SmartTestList) AddFlags ¶ added in v0.9.1
func (c *SmartTestList) AddFlags(cmd *cobra.Command)
type SmartTestRun ¶ added in v0.9.0
type SmartTestRun struct {
*SmartTestList
AddLabels TestExecLabels
Cluster string
Sandbox string
RouteGroup string
Publish bool
Timeout time.Duration
NoWait bool
}
SmartTestRun represents the configuration for running a test
func (*SmartTestRun) AddFlags ¶ added in v0.9.0
func (c *SmartTestRun) AddFlags(cmd *cobra.Command)
AddFlags adds the flags for the test run command
func (*SmartTestRun) Validate ¶ added in v1.2.0
func (smr *SmartTestRun) Validate() error
type TemplateVal ¶ added in v0.3.0
type TemplateVal struct {
Var, Val string
}
func (*TemplateVal) String ¶ added in v0.3.0
func (tv *TemplateVal) String() string
type TemplateVals ¶ added in v0.3.0
type TemplateVals []TemplateVal
func (*TemplateVals) Set ¶ added in v0.3.0
func (tvs *TemplateVals) Set(v string) error
func (*TemplateVals) String ¶ added in v0.3.0
func (tvs *TemplateVals) String() string
func (*TemplateVals) Type ¶ added in v0.3.0
func (tvs *TemplateVals) Type() string
type TestExecLabels ¶ added in v0.9.0
func (TestExecLabels) Set ¶ added in v0.9.0
func (rl TestExecLabels) Set(v string) error
func (TestExecLabels) String ¶ added in v0.9.0
func (rl TestExecLabels) String() string
func (TestExecLabels) ToQueryFilter ¶ added in v0.9.0
func (tl TestExecLabels) ToQueryFilter() []string
func (TestExecLabels) Type ¶ added in v0.9.0
func (tl TestExecLabels) Type() string
type TrafficInspect ¶ added in v1.3.0
func (*TrafficInspect) AddFlags ¶ added in v1.3.0
func (c *TrafficInspect) AddFlags(cmd *cobra.Command)
type TrafficWatch ¶ added in v1.3.0
type TrafficWatch struct {
*Traffic
// flags
OutputDir string
OutputFile string
Sandbox string
Short bool
HeadersOnly bool
WaitTimeout time.Duration
NoInstrument bool
Clean bool
TuiMode bool
}
func (*TrafficWatch) AddFlags ¶ added in v1.3.0
func (c *TrafficWatch) AddFlags(cmd *cobra.Command)