setup

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOrganizationName = "Local Workspace"
	DefaultOrganizationSlug = "local-workspace"
	DefaultProjectName      = "OpenASE Workspace"
	DefaultProjectSlug      = "openase-workspace"
	DefaultOIDCRedirectURL  = "http://127.0.0.1:19836/api/v1" + "/auth/oidc/callback"
	DefaultOIDCScopes       = "openid,profile,email,groups"
	DefaultOIDCSessionTTL   = "8h"
	DefaultOIDCIdleTTL      = "30m"
)

Variables

View Source
var ErrSetupAlreadyCompleted = errors.New("setup already completed")

Functions

This section is empty.

Types

type AgentOption

type AgentOption struct {
	ID          string                                 `json:"id"`
	Name        string                                 `json:"name"`
	Command     string                                 `json:"command"`
	AdapterType catalogdomain.AgentProviderAdapterType `json:"adapter_type"`
	ModelName   string                                 `json:"model_name"`
	Available   bool                                   `json:"available"`
	Path        string                                 `json:"path,omitempty"`
	Version     string                                 `json:"version,omitempty"`
}

type AuthConfig

type AuthConfig struct {
	Mode AuthModeType
	OIDC *OIDCConfig
}

func ParseAuthInput

func ParseAuthInput(raw RawAuthInput) (AuthConfig, error)

func (AuthConfig) Raw

func (c AuthConfig) Raw() RawAuthInput

type AuthModeOption

type AuthModeOption struct {
	ID          AuthModeType `json:"id"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
}

type AuthModeType

type AuthModeType string
const (
	AuthModeDisabled AuthModeType = "disabled"
	AuthModeOIDC     AuthModeType = "oidc"
)

type Bootstrap

type Bootstrap struct {
	ConfigExists bool                   `json:"config_exists"`
	ConfigPath   string                 `json:"config_path"`
	Sources      []DatabaseSourceOption `json:"sources"`
	Agents       []AgentOption          `json:"agents"`
	CLI          []CLIDiagnostic        `json:"cli"`
	Defaults     Defaults               `json:"defaults"`
}

type CLIDiagnostic

type CLIDiagnostic struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Command string `json:"command"`
	Status  string `json:"status"`
	Path    string `json:"path,omitempty"`
	Version string `json:"version,omitempty"`
	Message string `json:"message,omitempty"`
}

type CompleteRequest

type CompleteRequest struct {
	Database       DatabaseConfig
	Auth           AuthConfig
	AllowOverwrite bool
}

type CompleteResult

type CompleteResult struct {
	ConfigPath       string `json:"config_path"`
	EnvPath          string `json:"env_path"`
	OrganizationName string `json:"organization_name"`
	OrganizationSlug string `json:"organization_slug"`
	ProjectName      string `json:"project_name"`
	ProjectSlug      string `json:"project_slug"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Port     int
	Name     string
	User     string
	Password string
	SSLMode  string
}

func (DatabaseConfig) DSN

func (c DatabaseConfig) DSN() string

func (DatabaseConfig) Raw

type DatabaseConnector

type DatabaseConnector interface {
	Ping(context.Context, string) error
	Migrate(context.Context, string) error
}

type DatabaseSourceConfig

type DatabaseSourceConfig struct {
	Type   DatabaseSourceType
	Manual *DatabaseConfig
	Docker *DockerDatabaseConfig
}

type DatabaseSourceOption

type DatabaseSourceOption struct {
	ID          DatabaseSourceType `json:"id"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
}

type DatabaseSourceType

type DatabaseSourceType string
const (
	DatabaseSourceManual DatabaseSourceType = "manual"
	DatabaseSourceDocker DatabaseSourceType = "docker"
)

type Defaults

type Defaults struct {
	ManualDatabase RawDatabaseInput       `json:"manual_database"`
	DockerDatabase RawDockerDatabaseInput `json:"docker_database"`
}

type DesktopApplyResult added in v0.3.0

type DesktopApplyResult struct {
	Ready          bool                   `json:"ready"`
	ConfigPath     string                 `json:"config_path"`
	EnvPath        string                 `json:"env_path,omitempty"`
	OpenASEHomeDir string                 `json:"openase_home_dir"`
	DatabaseSource DatabaseSourceType     `json:"database_source,omitempty"`
	Docker         *DockerDatabaseRuntime `json:"docker,omitempty"`
	Issues         []DesktopIssue         `json:"issues,omitempty"`
}

type DesktopIssue added in v0.3.0

type DesktopIssue struct {
	Code    DesktopIssueCode `json:"code"`
	Title   string           `json:"title"`
	Message string           `json:"message"`
	Action  string           `json:"action,omitempty"`
}

type DesktopIssueCode added in v0.3.0

type DesktopIssueCode string
const (
	DesktopIssueConfigMissing        DesktopIssueCode = "config_missing"
	DesktopIssueConfigInvalid        DesktopIssueCode = "config_invalid"
	DesktopIssueDirectoryUnavailable DesktopIssueCode = "directory_unavailable"
	DesktopIssueDatabaseAuthFailed   DesktopIssueCode = "database_auth_failed"
	DesktopIssueDatabaseUnreachable  DesktopIssueCode = "database_unreachable"
	DesktopIssueDockerUnavailable    DesktopIssueCode = "docker_unavailable"
	DesktopIssuePortConflict         DesktopIssueCode = "port_conflict"
	DesktopIssueSetupTimeout         DesktopIssueCode = "setup_timeout"
	DesktopIssueInputInvalid         DesktopIssueCode = "input_invalid"
	DesktopIssueSetupFailed          DesktopIssueCode = "setup_failed"
)

type DesktopPreflightResult added in v0.3.0

type DesktopPreflightResult struct {
	Ready          bool           `json:"ready"`
	ConfigPath     string         `json:"config_path"`
	OpenASEHomeDir string         `json:"openase_home_dir"`
	Issues         []DesktopIssue `json:"issues,omitempty"`
}

type DockerDatabaseConfig

type DockerDatabaseConfig struct {
	ContainerName string
	DatabaseName  string
	User          string
	Port          int
	VolumeName    string
	Image         string
}

type DockerDatabaseRuntime

type DockerDatabaseRuntime struct {
	ContainerName string `json:"container_name"`
	DatabaseName  string `json:"database_name"`
	User          string `json:"user"`
	Port          int    `json:"port"`
	VolumeName    string `json:"volume_name"`
	Image         string `json:"image"`
}

type DockerRunner

type DockerRunner interface {
	Run(context.Context, string, ...string) (string, error)
}

type InstallInput

type InstallInput struct {
	Database     DatabaseConfig
	Agents       []AgentOption
	Organization OrganizationConfig
	Project      ProjectConfig
}

type Installer

type Installer interface {
	Initialize(context.Context, InstallInput) error
}

type OIDCConfig

type OIDCConfig struct {
	IssuerURL            string
	ClientID             string
	ClientSecret         string
	RedirectURL          string
	Scopes               []string
	AllowedEmailDomains  []string
	BootstrapAdminEmails []string
	SessionTTL           string
	SessionIdleTTL       string
}

type Options

type Options struct {
	HomeDir      string
	ConfigPath   string
	Resolver     provider.ExecutableResolver
	Connector    DatabaseConnector
	Installer    Installer
	DockerRunner DockerRunner
	RunCommand   func(context.Context, string, ...string) (string, error)
}

type OrganizationConfig

type OrganizationConfig struct {
	Name string
	Slug string
}

type PreparedDatabase

type PreparedDatabase struct {
	Source DatabaseSourceType
	Config DatabaseConfig
	Docker *DockerDatabaseRuntime
}

type ProjectConfig

type ProjectConfig struct {
	Name string
	Slug string
}

type RawAuthInput

type RawAuthInput struct {
	Mode string        `json:"mode"`
	OIDC *RawOIDCInput `json:"oidc,omitempty"`
}

type RawCompleteRequest

type RawCompleteRequest struct {
	Database       RawDatabaseInput `json:"database"`
	Auth           RawAuthInput     `json:"auth"`
	AllowOverwrite bool             `json:"allow_overwrite,omitempty"`
}

type RawDatabaseInput

type RawDatabaseInput struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Name     string `json:"name"`
	User     string `json:"user"`
	Password string `json:"password"`
	SSLMode  string `json:"ssl_mode"`
}

type RawDatabaseSourceInput

type RawDatabaseSourceInput struct {
	Type   string                  `json:"type"`
	Manual *RawDatabaseInput       `json:"manual,omitempty"`
	Docker *RawDockerDatabaseInput `json:"docker,omitempty"`
}

type RawDesktopApplyRequest added in v0.3.0

type RawDesktopApplyRequest struct {
	Database       RawDatabaseSourceInput `json:"database"`
	AllowOverwrite bool                   `json:"allow_overwrite,omitempty"`
}

type RawDockerDatabaseInput

type RawDockerDatabaseInput struct {
	ContainerName string `json:"container_name"`
	DatabaseName  string `json:"database_name"`
	User          string `json:"user"`
	Port          int    `json:"port"`
	VolumeName    string `json:"volume_name"`
	Image         string `json:"image"`
}

type RawOIDCInput

type RawOIDCInput struct {
	IssuerURL            string `json:"issuer_url"`
	ClientID             string `json:"client_id"`
	ClientSecret         string `json:"client_secret"`
	RedirectURL          string `json:"redirect_url"`
	Scopes               string `json:"scopes"`
	AllowedEmailDomains  string `json:"allowed_email_domains,omitempty"`
	BootstrapAdminEmails string `json:"bootstrap_admin_emails,omitempty"`
	SessionTTL           string `json:"session_ttl,omitempty"`
	SessionIdleTTL       string `json:"session_idle_ttl,omitempty"`
}

type Service

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

func NewService

func NewService(opts Options) (*Service, error)

func (*Service) Bootstrap

func (s *Service) Bootstrap(ctx context.Context) (Bootstrap, error)

func (*Service) Complete

func (s *Service) Complete(ctx context.Context, raw RawCompleteRequest) (CompleteResult, error)

func (*Service) DesktopApply added in v0.3.0

func (*Service) DesktopPreflight added in v0.3.0

func (s *Service) DesktopPreflight(ctx context.Context) (DesktopPreflightResult, error)

func (*Service) PrepareDatabase

func (s *Service) PrepareDatabase(ctx context.Context, raw RawDatabaseSourceInput) (PreparedDatabase, error)

Jump to

Keyboard shortcuts

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