Documentation
¶
Index ¶
- Constants
- Variables
- func CheckAllPublishedPortsNotListening() error
- func CheckTCPPortIsListening(port int) error
- func CheckVolumeExists(ctx context.Context) (bool, error)
- func DockerRm(ctx context.Context, name string, options DockerRmOptions) error
- func DockerStart(ctx context.Context, name string) error
- func DockerStop(ctx context.Context, name string) error
- func FlagsGetBool(cmd *cobra.Command, name string) bool
- func GenerateMachineFingerprint() string
- func GetDockerImage(cmd *cobra.Command) string
- func GetLicenseServerEndpoint(cmd *cobra.Command) string
- func GetPersistentEnvironmentVariableInVolume(ctx context.Context, envVarName string) (image string, err error)
- func PrintError(err error) error
- type CmdError
- type DockerContainer
- type DockerRmOptions
- type DockerRunOptions
- type DockerRunResult
- type DockerVolume
- type ErrCertbotFailedToGetCertificates
- type ErrTCPPortAlreadyListening
- type ErrorObject
- type FatalError
- type LicenseObject
- type LicenseOptions
- type LicenseResponse
- type LicenseServerResponseError
Constants ¶
View Source
const ( // ProgramName is the name of this program. ProgramName = "authgear-once" // BinDocker is the name of the binary of docker. BinDocker = "docker" // NOTE(once): Possibly breaking change // The name of the volume cannot be changed without any consideration. // NameDockerVolume is the name of the Docker volume. NameDockerVolume = "authgearonce_data" // NOTE(once): Possibly breaking change // The name of the container cannot be changed without any consideration. // NameDockerContainer is the name of the Docker container. NameDockerContainer = "authgearonce" DefaultDockerName_NoTag = "quay.io/theauthgear/authgear-once" )
View Source
const ( LicenseServerEndpoint = "https://once-license.authgear.com" LicenseServerEndpointOverridable = false QuestionName_EnableCertbot_PromptEnabled = false QuestionName_SelectCertbotEnvironment_PromptEnabled = false KeepInstallationContainerByDefault = false )
View Source
const (
CertbotExitCode10 = 10
)
View Source
const (
DockerVolumeScopeLocal = "local"
)
View Source
const (
Version = "1.0.0"
)
Variables ¶
View Source
var ( ErrNoDocker = errors.New("no docker") ErrDockerContainerNotExists = errors.New("docker container does not exist") ErrCommandUpgradeNotImplemented = errors.New("command upgrade not implemented") ErrLicenseServerUnknownResponse = errors.New("unknown response from license server") ErrLicenseServerLicenseKeyNotFound = errors.New("license server license key not found") ErrLicenseServerLicenseKeyAlreadyActivated = errors.New("license server license key already activated") ErrCertbotExitCode10 = errors.New("certbot exited with 10") )
View Source
var DockerPublishedPorts []int = []int{80, 443}
Functions ¶
func CheckAllPublishedPortsNotListening ¶
func CheckAllPublishedPortsNotListening() error
CheckAllPublishedPortsNotListening loops through DockerPublishedPorts and checks if any of them are already listening on the host. It returns an error if any of the ports are already in use.
func CheckTCPPortIsListening ¶
CheckTCPPortIsListening checks if a TCP port can be listened to. Returns nil if the port is available (can be listened to), ErrTCPPortAlreadyListening if the port is already in use.
func GenerateMachineFingerprint ¶
func GenerateMachineFingerprint() string
GenerateMachineFingerprint generates a cryptographically secure random string to represent a machine. This approach works even in a containerized environment, unlike https://github.com/denisbrodbeck/machineid
func GetDockerImage ¶
Types ¶
type DockerContainer ¶
type DockerRmOptions ¶
type DockerRmOptions struct {
Force bool
}
type DockerRunOptions ¶
type DockerRunOptions struct {
Detach bool
Restart string
Rm bool
Volume []string
Publish []string
Env []string
Name string
Image string
Command []string
}
func NewDockerRunOptionsForStarting ¶
func NewDockerRunOptionsForStarting(image string) DockerRunOptions
type DockerRunResult ¶
func DockerRun ¶
func DockerRun(ctx context.Context, opts DockerRunOptions) (*DockerRunResult, error)
func DockerRunWithCertbotErrorHandling ¶
func DockerRunWithCertbotErrorHandling(ctx context.Context, opts DockerRunOptions) (*DockerRunResult, error)
type DockerVolume ¶
func DockerVolumeLs ¶
func DockerVolumeLs(ctx context.Context) ([]DockerVolume, error)
type ErrCertbotFailedToGetCertificates ¶
type ErrCertbotFailedToGetCertificates struct {
Domains []string
}
func (*ErrCertbotFailedToGetCertificates) Error ¶
func (e *ErrCertbotFailedToGetCertificates) Error() string
type ErrTCPPortAlreadyListening ¶
type ErrTCPPortAlreadyListening struct {
Port int
}
func (*ErrTCPPortAlreadyListening) Error ¶
func (e *ErrTCPPortAlreadyListening) Error() string
type ErrorObject ¶
type ErrorObject struct {
Code string `json:"code"`
}
type FatalError ¶
type FatalError struct {
Err error
}
func (FatalError) Init ¶
func (m FatalError) Init() tea.Cmd
func (FatalError) View ¶
func (m FatalError) View() string
func (FatalError) WithErr ¶
func (m FatalError) WithErr(err error) FatalError
type LicenseObject ¶
type LicenseObject struct {
ExpireAt *time.Time `json:"expire_at"`
IsActivated bool `json:"is_activated"`
IsExpired bool `json:"is_expired"`
LicenseeEmail *string `json:"licensee_email"`
}
func ActivateLicense ¶
func ActivateLicense(ctx context.Context, client *http.Client, opts LicenseOptions) (licenseObject *LicenseObject, err error)
func CheckLicense ¶
func CheckLicense(ctx context.Context, client *http.Client, opts LicenseOptions) (licenseObject *LicenseObject, err error)
type LicenseOptions ¶
type LicenseResponse ¶
type LicenseResponse struct {
Data *LicenseObject `json:"data"`
Error *ErrorObject `json:"error"`
}
type LicenseServerResponseError ¶
type LicenseServerResponseError struct {
DumpedResponse []byte
}
func (*LicenseServerResponseError) Error ¶
func (e *LicenseServerResponseError) Error() string
Click to show internal directories.
Click to hide internal directories.