Documentation
¶
Index ¶
- Constants
- Variables
- func AddVaryHeader(next http.Handler) http.Handler
- func GenerateSelfSignedCertificate(certPath, keyPath string, validityDuration time.Duration) error
- func ParseSpec(pathSpec string, apps []types.AppPathDomain) ([]types.AppPathDomain, error)
- func ParseSpecFromInfo(pathSpec string, apps []types.AppInfo) ([]types.AppInfo, error)
- type AdminBasicAuth
- type AppStore
- func (a *AppStore) AddApp(app *app.App)
- func (a *AppStore) ClearAllAppCache()
- func (a *AppStore) DeleteApps(pathDomain []types.AppPathDomain)
- func (a *AppStore) DeleteLinkedApps(pathDomain types.AppPathDomain) error
- func (a *AppStore) GetAllApps() ([]types.AppInfo, error)
- func (a *AppStore) GetApp(pathDomain types.AppPathDomain) (*app.App, error)
- func (a *AppStore) UpdateApps(apps []*app.App)
- type Handler
- type SSOAuth
- func (s *SSOAuth) CheckAuth(w http.ResponseWriter, r *http.Request, appProvider string, ...) (bool, error)
- func (s *SSOAuth) RegisterRoutes(mux *chi.Mux)
- func (s *SSOAuth) Setup() error
- func (s *SSOAuth) ValidateAuthType(authType string) bool
- func (s *SSOAuth) ValidateProviderName(provider string) bool
- type Server
- func (s *Server) CheckAppValid(domain, matchPath string) (string, error)
- func (s *Server) CompleteTransaction(ctx context.Context, tx types.Transaction, entries []types.AppPathDomain, ...) error
- func (s *Server) CreateApp(ctx context.Context, appPath string, approve, dryRun bool, ...) (*types.AppCreateResponse, error)
- func (s *Server) DeleteApps(ctx context.Context, pathSpec string, dryRun bool) (*types.AppDeleteResponse, error)
- func (s *Server) FilterApps(appPathSpec string, includeInternal bool) ([]types.AppInfo, error)
- func (s *Server) GetApp(pathDomain types.AppPathDomain, init bool) (*app.App, error)
- func (s *Server) GetAppApi(ctx context.Context, appPath string) (*types.AppGetResponse, error)
- func (s *Server) GetAppEntry(ctx context.Context, tx types.Transaction, pathDomain types.AppPathDomain) (*types.AppEntry, error)
- func (s *Server) GetAppSpec(name types.AppSpec) types.SpecFiles
- func (s *Server) GetApps(ctx context.Context, pathSpec string, internal bool) ([]types.AppResponse, error)
- func (s *Server) MatchApp(hostHeader, matchPath string) (types.AppInfo, error)
- func (s *Server) PreviewApp(ctx context.Context, mainAppPath, commitId string, approve, dryRun bool) (*types.AppPreviewResponse, error)
- func (s *Server) PromoteApps(ctx context.Context, pathSpec string, dryRun bool) (*types.AppPromoteResponse, error)
- func (s *Server) ReloadApps(ctx context.Context, pathSpec string, approve, dryRun, promote bool, ...) (*types.AppReloadResponse, error)
- func (s *Server) StagedUpdate(ctx context.Context, pathSpec string, dryRun, promote bool, ...) (*types.AppStagedUpdateResponse, error)
- func (s *Server) StagedUpdateAppsTx(ctx context.Context, tx types.Transaction, pathSpec string, promote bool, ...) ([]any, []types.AppPathDomain, []types.AppPathDomain, error)
- func (s *Server) Start() error
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) UpdateAppSettings(ctx context.Context, pathSpec string, dryRun bool, ...) (*types.AppUpdateSettingsResponse, error)
- func (s *Server) VersionFiles(ctx context.Context, mainAppPath, version string) (*types.AppVersionFilesResponse, error)
- func (s *Server) VersionList(ctx context.Context, mainAppPath string) (*types.AppVersionListResponse, error)
- func (s *Server) VersionSwitch(ctx context.Context, mainAppPath string, dryRun bool, version string) (*types.AppVersionSwitchResponse, error)
Constants ¶
const ( VARY_HEADER = "Vary" DRY_RUN_ARG = "dryRun" PROMOTE_ARG = "promote" )
const ( DEFAULT_CERT_FILE = "default.crt" DEFAULT_KEY_FILE = "default.key" APPSPECS = "appspecs" )
const ( DOCKER_COMMAND = "docker" PODMAN_COMMAND = "podman" )
const ( PROVIDER_NAME_DELIMITER = "_" SESSION_COOKIE = "clace_session" AUTH_KEY = "authenticated" USER_ID_KEY = "user" USER_EMAIL_KEY = "email" PROVIDER_NAME_KEY = "provider_name" REDIRECT_URL = "redirect" )
const (
REALM = "clace"
)
Variables ¶
var CL_HOME = os.ExpandEnv("$CL_HOME")
CL_HOME is the root directory for Clace logs and temp files
var (
COMPRESSION_ENABLED_MIME_TYPES = []string{
"text/html",
"text/css",
"text/plain",
"text/xml",
"text/x-component",
"text/javascript",
"application/x-javascript",
"application/javascript",
"application/json",
"application/manifest+json",
"application/vnd.api+json",
"application/xml",
"application/xhtml+xml",
"application/rss+xml",
"application/atom+xml",
"application/vnd.ms-fontobject",
"application/x-font-ttf",
"application/x-font-opentype",
"application/x-font-truetype",
"image/svg+xml",
"image/x-icon",
"image/vnd.microsoft.icon",
"font/ttf",
"font/eot",
"font/otf",
"font/opentype",
}
)
Functions ¶
func ParseSpec ¶ added in v0.3.0
func ParseSpec(pathSpec string, apps []types.AppPathDomain) ([]types.AppPathDomain, error)
ParseSpec parses a path spec in the format of domain:path. If domain is not specified, it will match empty domain. glob patters are supported, *:** matches all apps.
func ParseSpecFromInfo ¶ added in v0.3.0
ParseSpecFromInfo parses a path spec in the format of domain:path. If domain is not specified, it will match empty domain. glob patters are supported, *:** matches all apps.
Types ¶
type AdminBasicAuth ¶
AdminBasicAuth implements basic auth for the admin user account. Cache the success auth header to avoid the bcrypt hash check penalty Basic auth is supported for admin user only, and changing it requires service restart. Caching the sha of the successful auth header allows us to skip the bcrypt check which significantly improves performance.
func NewAdminBasicAuth ¶
func NewAdminBasicAuth(logger *types.Logger, config *types.ServerConfig) *AdminBasicAuth
type AppStore ¶
AppStore is a store of apps. Apps are initialized lazily, the first GetApp call on each app will load the app from the database.
func (*AppStore) ClearAllAppCache ¶ added in v0.4.5
func (a *AppStore) ClearAllAppCache()
func (*AppStore) DeleteApps ¶ added in v0.3.0
func (a *AppStore) DeleteApps(pathDomain []types.AppPathDomain)
func (*AppStore) DeleteLinkedApps ¶ added in v0.3.0
func (a *AppStore) DeleteLinkedApps(pathDomain types.AppPathDomain) error
func (*AppStore) GetAllApps ¶ added in v0.4.5
func (*AppStore) UpdateApps ¶ added in v0.3.0
type Handler ¶
func NewTCPHandler ¶
NewTCPHandler creates a new handler for HTTP/HTTPS requests. App API's are mounted amd authentication is enabled. It also mounts the internal APIs if admin over TCP is enabled
func NewUDSHandler ¶
NewUDSHandler creates a new handler for admin APIs over the unix domain socket
type SSOAuth ¶ added in v0.5.0
func NewSSOAuth ¶ added in v0.5.0
func NewSSOAuth(logger *types.Logger, config *types.ServerConfig) *SSOAuth
func (*SSOAuth) RegisterRoutes ¶ added in v0.5.0
func (*SSOAuth) ValidateAuthType ¶ added in v0.5.0
func (*SSOAuth) ValidateProviderName ¶ added in v0.5.0
type Server ¶
Server is the instance of the Clace Server
func NewServer ¶
func NewServer(config *types.ServerConfig) (*Server, error)
NewServer creates a new instance of the Clace Server
func (*Server) CheckAppValid ¶ added in v0.3.0
func (*Server) CompleteTransaction ¶ added in v0.3.0
func (s *Server) CompleteTransaction(ctx context.Context, tx types.Transaction, entries []types.AppPathDomain, dryRun bool) error
func (*Server) CreateApp ¶ added in v0.2.0
func (s *Server) CreateApp(ctx context.Context, appPath string, approve, dryRun bool, appRequest types.CreateAppRequest) (*types.AppCreateResponse, error)
func (*Server) DeleteApps ¶ added in v0.3.0
func (*Server) FilterApps ¶ added in v0.3.0
func (*Server) GetAppEntry ¶ added in v0.3.0
func (s *Server) GetAppEntry(ctx context.Context, tx types.Transaction, pathDomain types.AppPathDomain) (*types.AppEntry, error)
func (*Server) GetAppSpec ¶ added in v0.6.0
func (*Server) PreviewApp ¶ added in v0.3.0
func (*Server) PromoteApps ¶ added in v0.3.0
func (*Server) ReloadApps ¶ added in v0.3.0
func (*Server) StagedUpdate ¶ added in v0.4.1
func (*Server) StagedUpdateAppsTx ¶ added in v0.4.1
func (s *Server) StagedUpdateAppsTx(ctx context.Context, tx types.Transaction, pathSpec string, promote bool, handler stagedUpdateHandler, args map[string]any) ([]any, []types.AppPathDomain, []types.AppPathDomain, error)
func (*Server) UpdateAppSettings ¶ added in v0.3.0
func (s *Server) UpdateAppSettings(ctx context.Context, pathSpec string, dryRun bool, updateAppRequest types.UpdateAppRequest) (*types.AppUpdateSettingsResponse, error)