commands

package
v4.38.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfirmationMismatch = errors.New("user input didn't match the confirmation prompt")

ErrConfirmationMismatch is returned when user input does not match the confirmation prompt.

View Source
var ErrStdinIsNotTerminal = errors.New("stdin is not a terminal")

ErrStdinIsNotTerminal is returned when Stdin is not an interactive terminal.

Functions

func NewRootCmd

func NewRootCmd() (cmd *cobra.Command)

NewRootCmd returns a new Root Cmd.

Types

type CmdCtx added in v4.38.0

type CmdCtx struct {
	context.Context
	// contains filtered or unexported fields
}

CmdCtx is a context.Context used for the root command.

func NewCmdCtx added in v4.38.0

func NewCmdCtx() *CmdCtx

NewCmdCtx returns a new CmdCtx.

func (*CmdCtx) AccessControlCheckRunE added in v4.38.0

func (ctx *CmdCtx) AccessControlCheckRunE(cmd *cobra.Command, _ []string) (err error)

func (*CmdCtx) BuildInfoRunE added in v4.38.0

func (ctx *CmdCtx) BuildInfoRunE(cmd *cobra.Command, _ []string) (err error)

BuildInfoRunE is the RunE for the authelia build-info command.

func (*CmdCtx) ChainRunE added in v4.38.0

func (ctx *CmdCtx) ChainRunE(cmdRunEs ...CobraRunECmd) CobraRunECmd

ChainRunE runs multiple CobraRunECmd funcs one after the other returning errors.

func (*CmdCtx) CheckSchema added in v4.38.0

func (ctx *CmdCtx) CheckSchema() (err error)

CheckSchema is a utility function which checks the schema version and encryption key.

func (*CmdCtx) CheckSchemaVersion added in v4.38.0

func (ctx *CmdCtx) CheckSchemaVersion() (err error)

func (*CmdCtx) ConfigEnsureExistsRunE added in v4.38.0

func (ctx *CmdCtx) ConfigEnsureExistsRunE(cmd *cobra.Command, _ []string) (err error)

ConfigEnsureExistsRunE logs the warnings and errors detected during the validations that have ran.

func (*CmdCtx) ConfigStorageCommandLineConfigRunE added in v4.38.0

func (ctx *CmdCtx) ConfigStorageCommandLineConfigRunE(cmd *cobra.Command, _ []string) (err error)

ConfigStorageCommandLineConfigRunE configures the storage command mapping.

func (*CmdCtx) ConfigTemplateRunE added in v4.38.0

func (ctx *CmdCtx) ConfigTemplateRunE(_ *cobra.Command, _ []string) (err error)

ConfigTemplateRunE is the RunE for the authelia validate-config command.

func (*CmdCtx) ConfigValidateLogRunE added in v4.38.0

func (ctx *CmdCtx) ConfigValidateLogRunE(_ *cobra.Command, _ []string) (err error)

ConfigValidateLogRunE logs the warnings and errors detected during the validations that have ran.

func (*CmdCtx) ConfigValidateRunE added in v4.38.0

func (ctx *CmdCtx) ConfigValidateRunE(_ *cobra.Command, _ []string) (err error)

ConfigValidateRunE is the RunE for the authelia validate-config command.

func (*CmdCtx) ConfigValidateSectionPasswordRunE added in v4.38.0

func (ctx *CmdCtx) ConfigValidateSectionPasswordRunE(cmd *cobra.Command, _ []string) (err error)

ConfigValidateSectionPasswordRunE validates the configuration (structure, password section).

func (*CmdCtx) ConfigValidateStorageRunE added in v4.38.0

func (ctx *CmdCtx) ConfigValidateStorageRunE(_ *cobra.Command, _ []string) (err error)

ConfigValidateStorageRunE validates the storage config before running commands using it.

func (*CmdCtx) CryptoCertificateGenerateRunE added in v4.38.0

func (ctx *CmdCtx) CryptoCertificateGenerateRunE(cmd *cobra.Command, _ []string, privateKey any) (err error)

CryptoCertificateGenerateRunE is the RunE for the authelia crypto certificate [rsa|ecdsa|ed25519] commands.

func (*CmdCtx) CryptoCertificateRequestRunE added in v4.38.0

func (ctx *CmdCtx) CryptoCertificateRequestRunE(cmd *cobra.Command, _ []string) (err error)

CryptoCertificateRequestRunE is the RunE for the authelia crypto certificate request command.

func (*CmdCtx) CryptoGenerateRunE added in v4.38.0

func (ctx *CmdCtx) CryptoGenerateRunE(cmd *cobra.Command, args []string) (err error)

CryptoGenerateRunE is the RunE for the authelia crypto [pair|certificate] [rsa|ecdsa|ed25519] commands.

func (*CmdCtx) CryptoHashGenerateMapFlagsRunE added in v4.38.0

func (ctx *CmdCtx) CryptoHashGenerateMapFlagsRunE(cmd *cobra.Command, args []string) (err error)

CryptoHashGenerateMapFlagsRunE is the RunE which configures the flags map configuration source for the authelia crypto hash generate commands.

func (*CmdCtx) CryptoHashGenerateRunE added in v4.38.0

func (ctx *CmdCtx) CryptoHashGenerateRunE(cmd *cobra.Command, args []string) (err error)

CryptoHashGenerateRunE is the RunE for the authelia crypto hash generate commands.

func (*CmdCtx) CryptoHashValidateRunE added in v4.38.0

func (ctx *CmdCtx) CryptoHashValidateRunE(cmd *cobra.Command, args []string) (err error)

CryptoHashValidateRunE is the RunE for the authelia crypto hash validate command.

func (*CmdCtx) CryptoPairGenerateRunE added in v4.38.0

func (ctx *CmdCtx) CryptoPairGenerateRunE(cmd *cobra.Command, _ []string, privateKey any) (err error)

CryptoPairGenerateRunE is the RunE for the authelia crypto pair [rsa|ecdsa|ed25519] commands.

func (*CmdCtx) CryptoRandRunE added in v4.38.0

func (ctx *CmdCtx) CryptoRandRunE(cmd *cobra.Command, args []string) (err error)

CryptoRandRunE is the RunE for the authelia crypto rand command.

func (*CmdCtx) HelperConfigLoadRunE added in v4.38.0

func (ctx *CmdCtx) HelperConfigLoadRunE(cmd *cobra.Command, _ []string) (err error)

HelperConfigLoadRunE loads the configuration into the CmdCtx.

func (*CmdCtx) HelperConfigSetDefaultsRunE added in v4.38.0

func (ctx *CmdCtx) HelperConfigSetDefaultsRunE(defaults map[string]any) CobraRunECmd

HelperConfigSetDefaultsRunE adds a defaults configuration source.

func (*CmdCtx) HelperConfigSetFlagsMapRunE added in v4.38.0

func (ctx *CmdCtx) HelperConfigSetFlagsMapRunE(flags *pflag.FlagSet, flagsMap map[string]string, includeInvalidKeys, includeUnchangedKeys bool) (err error)

HelperConfigSetFlagsMapRunE adds a command line source with flags mapping.

func (*CmdCtx) HelperConfigValidateKeysRunE added in v4.38.0

func (ctx *CmdCtx) HelperConfigValidateKeysRunE(_ *cobra.Command, _ []string) (err error)

HelperConfigValidateKeysRunE validates the configuration (keys).

func (*CmdCtx) HelperConfigValidateRunE added in v4.38.0

func (ctx *CmdCtx) HelperConfigValidateRunE(_ *cobra.Command, _ []string) (err error)

HelperConfigValidateRunE validates the configuration (structure).

func (*CmdCtx) LoadProviders added in v4.38.0

func (ctx *CmdCtx) LoadProviders() (warns, errs []error)

LoadProviders loads all providers into the CmdCtx.

func (*CmdCtx) LoadProvidersStorageRunE added in v4.38.0

func (ctx *CmdCtx) LoadProvidersStorageRunE(cmd *cobra.Command, args []string) (err error)

LoadProvidersStorageRunE is a special PreRunE that loads the storage provider into the CmdCtx.

func (*CmdCtx) LoadTrustedCertificates added in v4.38.0

func (ctx *CmdCtx) LoadTrustedCertificates() (warns, errs []error)

LoadTrustedCertificates loads the trusted certificates into the CmdCtx.

func (*CmdCtx) LogConfigure added in v4.38.0

func (ctx *CmdCtx) LogConfigure(_ *cobra.Command, _ []string) (err error)

func (*CmdCtx) LogProcessCurrentUserRunE added in v4.38.0

func (ctx *CmdCtx) LogProcessCurrentUserRunE(_ *cobra.Command, _ []string) (err error)

func (*CmdCtx) NewStorageMigrateListRunE added in v4.38.0

func (ctx *CmdCtx) NewStorageMigrateListRunE(up bool) func(cmd *cobra.Command, args []string) (err error)

NewStorageMigrateListRunE creates the RunE for the authelia storage migrate list command.

func (*CmdCtx) NewStorageMigrationRunE added in v4.38.0

func (ctx *CmdCtx) NewStorageMigrationRunE(up bool) func(cmd *cobra.Command, args []string) (err error)

NewStorageMigrationRunE creates the RunE for the authelia storage migrate command.

func (*CmdCtx) RootRunE added in v4.38.0

func (ctx *CmdCtx) RootRunE(_ *cobra.Command, _ []string) (err error)

func (*CmdCtx) StorageMigrateHistoryRunE added in v4.38.0

func (ctx *CmdCtx) StorageMigrateHistoryRunE(_ *cobra.Command, _ []string) (err error)

StorageMigrateHistoryRunE is the RunE for the authelia storage migrate history command.

func (*CmdCtx) StorageSchemaEncryptionChangeKeyRunE added in v4.38.0

func (ctx *CmdCtx) StorageSchemaEncryptionChangeKeyRunE(cmd *cobra.Command, args []string) (err error)

StorageSchemaEncryptionChangeKeyRunE is the RunE for the authelia storage encryption change-key command.

func (*CmdCtx) StorageSchemaEncryptionCheckRunE added in v4.38.0

func (ctx *CmdCtx) StorageSchemaEncryptionCheckRunE(cmd *cobra.Command, args []string) (err error)

func (*CmdCtx) StorageSchemaInfoRunE added in v4.38.0

func (ctx *CmdCtx) StorageSchemaInfoRunE(_ *cobra.Command, _ []string) (err error)

StorageSchemaInfoRunE is the RunE for the authelia storage schema info command.

func (*CmdCtx) StorageUserIdentifiersAddRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserIdentifiersAddRunE(cmd *cobra.Command, args []string) (err error)

StorageUserIdentifiersAddRunE is the RunE for the authelia storage user identifiers add command.

func (*CmdCtx) StorageUserIdentifiersExportRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserIdentifiersExportRunE(cmd *cobra.Command, _ []string) (err error)

StorageUserIdentifiersExportRunE is the RunE for the authelia storage user identifiers export command.

func (*CmdCtx) StorageUserIdentifiersGenerateRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserIdentifiersGenerateRunE(cmd *cobra.Command, _ []string) (err error)

StorageUserIdentifiersGenerateRunE is the RunE for the authelia storage user identifiers generate command.

func (*CmdCtx) StorageUserIdentifiersImportRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserIdentifiersImportRunE(cmd *cobra.Command, args []string) (err error)

StorageUserIdentifiersImportRunE is the RunE for the authelia storage user identifiers import command.

func (*CmdCtx) StorageUserTOTPDeleteRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPDeleteRunE(cmd *cobra.Command, args []string) (err error)

StorageUserTOTPDeleteRunE is the RunE for the authelia storage user totp delete command.

func (*CmdCtx) StorageUserTOTPExportCSVRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPExportCSVRunE(cmd *cobra.Command, _ []string) (err error)

func (*CmdCtx) StorageUserTOTPExportPNGRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPExportPNGRunE(cmd *cobra.Command, _ []string) (err error)

func (*CmdCtx) StorageUserTOTPExportRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPExportRunE(cmd *cobra.Command, _ []string) (err error)

StorageUserTOTPExportRunE is the RunE for the authelia storage user totp export command.

func (*CmdCtx) StorageUserTOTPExportURIRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPExportURIRunE(_ *cobra.Command, _ []string) (err error)

func (*CmdCtx) StorageUserTOTPGenerateRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPGenerateRunE(cmd *cobra.Command, args []string) (err error)

StorageUserTOTPGenerateRunE is the RunE for the authelia storage user totp generate command.

func (*CmdCtx) StorageUserTOTPImportRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserTOTPImportRunE(_ *cobra.Command, args []string) (err error)

func (*CmdCtx) StorageUserWebAuthnDeleteRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserWebAuthnDeleteRunE(cmd *cobra.Command, args []string) (err error)

StorageUserWebAuthnDeleteRunE is the RunE for the authelia storage user webauthn delete command.

func (*CmdCtx) StorageUserWebAuthnExportRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserWebAuthnExportRunE(cmd *cobra.Command, args []string) (err error)

func (*CmdCtx) StorageUserWebAuthnImportRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserWebAuthnImportRunE(cmd *cobra.Command, args []string) (err error)

func (*CmdCtx) StorageUserWebAuthnListAllRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserWebAuthnListAllRunE(_ *cobra.Command, _ []string) (err error)

StorageUserWebAuthnListAllRunE is the RunE for the authelia storage user webauthn list command when no args are specified.

func (*CmdCtx) StorageUserWebAuthnListRunE added in v4.38.0

func (ctx *CmdCtx) StorageUserWebAuthnListRunE(cmd *cobra.Command, args []string) (err error)

StorageUserWebAuthnListRunE is the RunE for the authelia storage user webauthn list command.

type CmdCtxConfig added in v4.38.0

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

CmdCtxConfig is the configuration for the CmdCtx.

func NewCmdCtxConfig added in v4.38.0

func NewCmdCtxConfig() *CmdCtxConfig

NewCmdCtxConfig returns a new CmdCtxConfig.

type CobraRunECmd added in v4.38.0

type CobraRunECmd func(cmd *cobra.Command, args []string) (err error)

CobraRunECmd describes a function that can be used as a *cobra.Command RunE, PreRunE, or PostRunE.

type FileWatcherService added in v4.38.0

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

FileWatcherService is a Service that watches files for changes.

func NewFileWatcherService added in v4.38.0

func NewFileWatcherService(name, path string, reload ProviderReload, log *logrus.Logger) (service *FileWatcherService, err error)

NewFileWatcherService creates a new FileWatcherService with the appropriate logger etc.

func (*FileWatcherService) Log added in v4.38.0

func (service *FileWatcherService) Log() *logrus.Entry

Log returns the *logrus.Entry of the FileWatcherService.

func (*FileWatcherService) Run added in v4.38.0

func (service *FileWatcherService) Run() (err error)

Run the FileWatcherService.

func (*FileWatcherService) ServiceName added in v4.38.0

func (service *FileWatcherService) ServiceName() string

ServiceName returns the individual name for this service.

func (*FileWatcherService) ServiceType added in v4.38.0

func (service *FileWatcherService) ServiceType() string

ServiceType returns the service type for this service, which is always 'watcher'.

func (*FileWatcherService) Shutdown added in v4.38.0

func (service *FileWatcherService) Shutdown()

Shutdown the FileWatcherService.

type ProviderReload added in v4.37.0

type ProviderReload interface {
	Reload() (reloaded bool, err error)
}

ProviderReload represents the required methods to support reloading a provider.

type ServerService added in v4.38.0

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

ServerService is a Service which runs a web server.

func NewServerService added in v4.38.0

func NewServerService(name string, server *fasthttp.Server, listener net.Listener, paths []string, isTLS bool, log *logrus.Logger) (service *ServerService)

NewServerService creates a new ServerService with the appropriate logger etc.

func (*ServerService) Log added in v4.38.0

func (service *ServerService) Log() *logrus.Entry

Log returns the *logrus.Entry of the ServerService.

func (*ServerService) Run added in v4.38.0

func (service *ServerService) Run() (err error)

Run the ServerService.

func (*ServerService) ServiceName added in v4.38.0

func (service *ServerService) ServiceName() string

ServiceName returns the individual name for this service.

func (*ServerService) ServiceType added in v4.38.0

func (service *ServerService) ServiceType() string

ServiceType returns the service type for this service, which is always 'server'.

func (*ServerService) Shutdown added in v4.38.0

func (service *ServerService) Shutdown()

Shutdown the ServerService.

type Service added in v4.38.0

type Service interface {
	// ServiceType returns the type name for the Service.
	ServiceType() string

	// ServiceName returns the individual name for the Service.
	ServiceName() string

	// Run performs the running operations for the Service.
	Run() (err error)

	// Shutdown perform the shutdown cleanup and termination operations for the Service.
	Shutdown()

	// Log returns the logger configured for the service.
	Log() *logrus.Entry
}

Service represents the required methods to support handling a service.

type XEnvCLIResult added in v4.38.0

type XEnvCLIResult int
const (
	XEnvCLIResultCLIExplicit XEnvCLIResult = iota
	XEnvCLIResultCLIImplicit
	XEnvCLIResultEnvironment
)

Jump to

Keyboard shortcuts

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