config

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverDocker = "docker"
)

Variables

View Source
var (
	// ErrEnvNameIsInvalid occurs when the environment name is invalid. It should be a valid hostname.
	ErrEnvNameIsInvalid = fmt.Errorf("environment name is invalid, it should match RFC1178")
	// ErrEnvIsEmpty occurs when environment name is empty.
	ErrEnvIsEmpty = fmt.Errorf("env name is empty. please run `reward env-init`")
	// ErrUnknownAction occurs when an unknown actions is called.
	ErrUnknownAction = fmt.Errorf("unknown action error")

	// ErrInvokedAsRootUser occurs when the Application was called by Root user.
	ErrInvokedAsRootUser = fmt.Errorf(
		"in most cases, you should not run as root user except for `self-update` " +
			"if you are sure you want to do this, use REWARD_ALLOW_SUPERUSER=1",
	)

	ErrHostnameRequired   = fmt.Errorf("hostname is required")
	ErrCaCertDoesNotExist = fmt.Errorf(
		"the root CA certificate is missing, please run " +
			"'reward install' and try again",
	)

	// ErrUnknownEnvType occurs when an unknown environment type is specified.
	ErrUnknownEnvType = fmt.Errorf("unknown env type")
)
View Source
var FS = &afero.Afero{Fs: afero.NewOsFs()}

FS is the implementation of Afero Filesystem. It's a filesystem wrapper and used for testing.

Functions

This section is empty.

Types

type Config

type Config struct {
	*viper.Viper
	Shell               shell.Shell
	Docker              *docker.Client
	Compose             compose.Client
	ShellUser           string
	ShellContainer      string
	DefaultShellCommand string
	TmpFiles            *list.List
}

func New

func New(name, ver string) *Config

func (*Config) AdditionalServices

func (c *Config) AdditionalServices() []string

func (*Config) AlternativesArgs added in v0.5.0

func (c *Config) AlternativesArgs() string

func (*Config) AppHomeDir

func (c *Config) AppHomeDir() string

AppHomeDir returns the application's home directory.

func (*Config) AppName

func (c *Config) AppName() string

AppName returns the application's name.

func (*Config) AppVersion

func (c *Config) AppVersion() string

AppVersion returns the application's version.

func (*Config) BlackfireCommand

func (c *Config) BlackfireCommand() string

BlackfireCommand returns the command which is called when the application manipulates blackfire.

func (*Config) BlackfireContainer

func (c *Config) BlackfireContainer() string

BlackfireContainer returns the container name of the Blackfire debug container.

func (*Config) BlackfireEnabled

func (c *Config) BlackfireEnabled() bool

BlackfireEnabled returns true if the blackfire container is enabled.

func (*Config) Check

func (c *Config) Check(cmd *cobra.Command, args []string) error

func (*Config) CheckInvokerUser

func (c *Config) CheckInvokerUser(cmd *cobra.Command) error

CheckInvokerUser returns an error if the invoker user is root.

func (*Config) Cleanup

func (c *Config) Cleanup() error

Cleanup removes all the temporary template files.

func (*Config) ComposerVersion

func (c *Config) ComposerVersion() *version.Version

ComposerVersion returns the Composer Version defined in Config settings.

func (*Config) CryptKey

func (c *Config) CryptKey() string

func (*Config) Cwd

func (c *Config) Cwd() string

Cwd returns the current working directory.

func (*Config) DBCommand

func (c *Config) DBCommand() string

DBCommand returns the command which is called when the application manipulates the database.

func (*Config) DBContainer

func (c *Config) DBContainer() string

DBContainer returns the name of the database container.

func (*Config) DBDumpCommand

func (c *Config) DBDumpCommand() string

DBDumpCommand returns the command which is called when the application dumps a database.

func (*Config) DBPrefix

func (c *Config) DBPrefix() string

func (*Config) DefaultSyncedContainer

func (c *Config) DefaultSyncedContainer(envType string) string

func (*Config) DefaultSyncedDir

func (c *Config) DefaultSyncedDir(envType string) string

func (*Config) DockerHost

func (c *Config) DockerHost() string

func (*Config) DockerPeeredServices

func (c *Config) DockerPeeredServices(action, networkName string) error

DockerPeeredServices attaches/detaches the common services to the current environment's docker network.

func (*Config) Driver added in v0.6.0

func (c *Config) Driver() string

func (*Config) EnvCheck

func (c *Config) EnvCheck() error

EnvCheck returns an error if the env name is empty (.env file does not contain an env name).

func (*Config) EnvInitialized

func (c *Config) EnvInitialized() bool

func (*Config) EnvName

func (c *Config) EnvName() string

EnvName returns the environment name in lowercase format.

func (*Config) EnvNetworkName

func (c *Config) EnvNetworkName() string

EnvNetworkName returns the environments docker network name in lowercase format.

func (*Config) EnvType

func (c *Config) EnvType() string

EnvType returns the environment type in lowercase format.

func (*Config) EnvTypes

func (c *Config) EnvTypes() map[string]string

func (*Config) FullBootstrap

func (c *Config) FullBootstrap() bool

FullBootstrap checks if full bootstrap is enabled in configs.

func (*Config) GitHubToken

func (c *Config) GitHubToken() string

func (*Config) Init

func (c *Config) Init() *Config

func (*Config) InstallMarkerFilePath

func (c *Config) InstallMarkerFilePath() string

InstallMarkerFilePath returns the filepath of the Install Marker file.

func (*Config) Installed

func (c *Config) Installed() bool

Installed returns true if the application is installed, false anyway.

func (*Config) IsDebug

func (c *Config) IsDebug() bool

IsDebug returns true if debug mode is set.

func (*Config) IsSvcEnabled

func (c *Config) IsSvcEnabled(s string) bool

IsSvcEnabled returns true if the s service is enabled for the current environment.

func (*Config) LocalBinPath added in v0.5.0

func (c *Config) LocalBinPath() string

LocalBinPath returns "$HOME/.local/bin" if the container is rootless and "/usr/local/bin" otherwise.

func (*Config) MagentoBackendFrontname

func (c *Config) MagentoBackendFrontname() string

MagentoBackendFrontname returns Magento admin path from Config settings.

func (*Config) MagentoDisableTFA

func (c *Config) MagentoDisableTFA() bool

MagentoDisableTFA checks if the installer should Disable TwoFactorAuth module in configs.

func (*Config) MagentoMode

func (c *Config) MagentoMode() string

MagentoMode returns Magento mode: developer or production (default: developer).

func (*Config) MagentoType

func (c *Config) MagentoType() string

MagentoType returns Magento type: enterprise or community (default: community).

func (*Config) MagentoVersion

func (c *Config) MagentoVersion() (*version.Version, error)

MagentoVersion returns a *version.Version object which contains the Magento version.

func (*Config) MagentoVersionFromConfig

func (c *Config) MagentoVersionFromConfig() *version.Version

MagentoVersionFromConfig returns a *version.Version object from Config settings. Note: If it's unset, it will return a dedicated latest version.

func (*Config) MutagenRequiredVersion

func (c *Config) MutagenRequiredVersion() string

MutagenRequiredVersion returns the content of the REWARD_MUTAGEN_VERSION variable.

func (*Config) MutagenSyncFile

func (c *Config) MutagenSyncFile() string

MutagenSyncFile returns the file path of the mutagen sync file.

func (*Config) MutagenSyncIgnore

func (c *Config) MutagenSyncIgnore() string

MutagenSyncIgnore returns the additional mutagen ignored files.

func (*Config) MutagenURL

func (c *Config) MutagenURL() string

MutagenURL returns the content of the REWARD_MUTAGEN_URL variable.

func (*Config) NoPull

func (c *Config) NoPull() bool

NoPull checks if docker-compose pull is disabled in configs.

func (*Config) OptionalServices

func (c *Config) OptionalServices() []string

func (*Config) Parallel

func (c *Config) Parallel() bool

Parallel checks if composer parallel mode is enabled in configs.

func (*Config) Plugins

func (c *Config) Plugins() []*Plugin

func (*Config) PluginsAvailable

func (c *Config) PluginsAvailable() map[string]*Plugin

func (*Config) PluginsConfigDir

func (c *Config) PluginsConfigDir() string

func (*Config) PluginsDir

func (c *Config) PluginsDir() string

func (*Config) RepoURL

func (c *Config) RepoURL() string

RepoURL returns the repository URL for self-update.

func (*Config) ResetAdminURL

func (c *Config) ResetAdminURL() bool

ResetAdminURL checks if the installer should Reset the Admin URLs in Viper settings.

func (*Config) ResolveDomainToTraefik

func (c *Config) ResolveDomainToTraefik() bool

func (*Config) Rootless added in v0.5.0

func (c *Config) Rootless() bool

func (*Config) SPXEnabled added in v0.6.1

func (c *Config) SPXEnabled() bool

SPXEnabled returns true if the blackfire container is enabled.

func (*Config) SSLBaseDir

func (c *Config) SSLBaseDir() string

func (*Config) SSLCABaseDir

func (c *Config) SSLCABaseDir() string

func (*Config) SSLCADir

func (c *Config) SSLCADir() string

func (*Config) SSLCertBaseDir

func (c *Config) SSLCertBaseDir() string

func (*Config) SSLCertDir

func (c *Config) SSLCertDir() string

func (*Config) SSLDir

func (c *Config) SSLDir() string

func (*Config) ServiceDomain

func (c *Config) ServiceDomain() string

ServiceDomain returns the application's service domain.

func (*Config) ServiceEnabled

func (c *Config) ServiceEnabled(servicename string) bool

ServiceEnabled returns true if service is enabled in Config settings.

func (*Config) Services

func (c *Config) Services() []string

func (*Config) SetDefaultShellCommand

func (c *Config) SetDefaultShellCommand(containerName string)

SetDefaultShellCommand changes the command invoked by reward shell command.

func (*Config) SetInterfaces added in v0.6.0

func (c *Config) SetInterfaces()

func (*Config) SetLocalDefaults

func (c *Config) SetLocalDefaults()

func (*Config) SetLogging

func (c *Config) SetLogging()

SetLogging sets the logging level based on the command line flags and environment variables.

func (*Config) SetNonLocalDefaults

func (c *Config) SetNonLocalDefaults()

func (*Config) SetPHPDefaults

func (c *Config) SetPHPDefaults(envType string)

func (*Config) SetPWADefaults

func (c *Config) SetPWADefaults()

func (*Config) SetSeleniumDefaults

func (c *Config) SetSeleniumDefaults()

TODO: test if this works as expected.

func (*Config) SetShellContainer

func (c *Config) SetShellContainer(envType string)

SetShellContainer changes the container used for the reward shell command.

func (*Config) SetShellUser

func (c *Config) SetShellUser(containerName string)

SetShellUser changes the user of the reward shell command.

func (*Config) SetSyncSettings

func (c *Config) SetSyncSettings()

SetSyncSettings sets the settings for synchronization.

func (*Config) SetSyncedContainer

func (c *Config) SetSyncedContainer(s string)

SetSyncedContainer sets the synced container name in REWARD_ENV_SYNCED_CONTAINER variable.

func (*Config) SetSyncedDir

func (c *Config) SetSyncedDir(s string)

SetSyncedDir sets the REWARD_ENV_SYNCED_DIRECTORY variable.

func (*Config) ShopwareAdminPath

func (c *Config) ShopwareAdminPath() string

ShopwareAdminPath returns shopware admin path from Config settings.

func (*Config) ShopwareMode

func (c *Config) ShopwareMode() string

func (*Config) ShopwareVersion

func (c *Config) ShopwareVersion() (*version.Version, error)

func (*Config) Shortcuts

func (c *Config) Shortcuts() map[string]string

func (*Config) SilenceErrors

func (c *Config) SilenceErrors() bool

func (*Config) SingleWebContainer

func (c *Config) SingleWebContainer() bool

SingleWebContainer returns true if Single Web Container setting is enabled in Viper settings.

func (*Config) SkipCleanup

func (c *Config) SkipCleanup() bool

func (*Config) SkipComposerInstall

func (c *Config) SkipComposerInstall() bool

SkipComposerInstall checks if composer install is disabled in configs.

func (*Config) SudoCommand added in v0.5.0

func (c *Config) SudoCommand() string

SudoCommand returns "sudo" if the used container is not rootless.

func (*Config) SuperuserAllowed

func (c *Config) SuperuserAllowed() bool

SuperuserAllowed returns true if the application is allowed to be invoked by root.

func (*Config) SvcEnabledPermissive

func (c *Config) SvcEnabledPermissive(s string) bool

SvcEnabledPermissive returns true if the s service is enabled in Viper settings. This function is also going to return true if the service is not mentioned in Viper settings (defaults to true).

func (*Config) SvcEnabledStrict

func (c *Config) SvcEnabledStrict(s string) bool

SvcEnabledStrict returns true if the s service is enabled in Viper settings. This function is going to return false if the service is not mentioned in Viper settings (defaults to false).

func (*Config) SyncEnabled

func (c *Config) SyncEnabled() bool

SyncEnabled returns true for macOS and Windows if it's not disabled explicitly (or if the WSL2 Direct Mount option is not enabled on Windows).

func (*Config) SyncedContainer

func (c *Config) SyncedContainer() string

SyncedContainer returns the container name of the synced container from REWARD_ENV_SYNCED_CONTAINER variable.

func (*Config) SyncedDir

func (c *Config) SyncedDir() string

SyncedDir returns the directory which is synced with the host stored in the REWARD_ENV_SYNCED_DIR environment variable.

func (*Config) TraefikDomain

func (c *Config) TraefikDomain() string

TraefikDomain returns traefik domain from Viper settings.

func (*Config) TraefikFullDomain

func (c *Config) TraefikFullDomain() string

TraefikFullDomain returns traefik full domain (subdomain + domain merged).

func (*Config) TraefikSubdomain

func (c *Config) TraefikSubdomain() string

TraefikSubdomain returns traefik subdomain from Viper settings.

func (*Config) ValidEnvTypes

func (c *Config) ValidEnvTypes() []string

ValidEnvTypes return a list of valid environment types based on the predefined EnvTypes.

func (*Config) WebRoot

func (c *Config) WebRoot() string

WebRoot returns the content of the WEB_ROOT variable.

func (*Config) WithSampleData

func (c *Config) WithSampleData() bool

WithSampleData checks if Magento 2 sample data is enabled in configs.

func (*Config) WordpressAdminPath

func (c *Config) WordpressAdminPath() string

WordpressAdminPath returns WordPress admin path from Config settings.

type Plugin

type Plugin struct {
	Name        string
	Path        string
	Description string
	URL         string
}

func (*Plugin) String

func (p *Plugin) String() string

Jump to

Keyboard shortcuts

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