Documentation
¶
Index ¶
- Constants
- Variables
- func AddUserFile(ctx context.Context, file *types.UserFile) error
- func AppFileOptions() *syntax.FileOptions
- func ClearCleanup(thread *starlark.Thread, key string)
- func CreatePluginApi(f StarlarkFunction, opType PluginFunctionType) plugin.PluginFunc
- func CreatePluginApiName(...) plugin.PluginFunc
- func CreatePluginConstant(name string, value starlark.Value) plugin.PluginFunc
- func DeferCleanup(thread *starlark.Thread, key string, deferFunc apptype.DeferFunc, strict bool)
- func DeleteUserFile(ctx context.Context, id string) error
- func FetchPluginState(thread *starlark.Thread, key string) any
- func GetContext(thread *starlark.Thread) context.Context
- func GetUserFile(ctx context.Context, id string) (*types.UserFile, error)
- func InitFileStore(ctx context.Context, connectString string) error
- func NewFSPlugin(pluginContext *types.PluginContext) (any, error)
- func RegisterPlugin(name string, builder plugin.NewPluginFunc, funcs []plugin.PluginFunc)
- func SavePluginState(thread *starlark.Thread, key string, value any)
- type AccessType
- type App
- func (a *App) Audit() (*types.ApproveResult, error)
- func (a *App) Close() error
- func (a *App) Initialize(ctx context.Context, dryRun types.DryRun) error
- func (a *App) Reload(ctx context.Context, force, immediate bool, dryRun types.DryRun, ...) (bool, error)
- func (a *App) ResetFS()
- func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type AppPlugins
- type ByteWindow
- type ContainerHandler
- func (h *ContainerHandler) Close() error
- func (h *ContainerHandler) DevReload(ctx context.Context, dryRun bool) error
- func (h *ContainerHandler) GetEnvMap() (map[string]string, string)
- func (h *ContainerHandler) GetHealthUrl(appHealthUrl string) string
- func (h *ContainerHandler) GetProxyUrl() string
- func (h *ContainerHandler) ProdReload(ctx context.Context, dryRun bool) error
- func (h *ContainerHandler) Run(ctx context.Context, path string, cmdArgs []string, env []string) (*exec.Cmd, error)
- func (h *ContainerHandler) WaitForHealth(attempts int, containerName container.ContainerName) error
- type ContainerState
- type FileInfo
- type PluginFunctionType
- type PluginResponse
- func (r *PluginResponse) Attr(name string) (starlark.Value, error)
- func (r *PluginResponse) AttrNames() []string
- func (r *PluginResponse) Freeze()
- func (r *PluginResponse) Hash() (uint32, error)
- func (r *PluginResponse) String() string
- func (r *PluginResponse) Truth() starlark.Bool
- func (r *PluginResponse) Type() string
- func (r *PluginResponse) UnmarshalStarlarkType() (any, error)
- type SSEMessage
- type StarlarkFunction
- type Tracker
Constants ¶
View Source
const ( CONTAINERFILE = "Containerfile" DOCKERFILE = "Dockerfile" )
View Source
const ( DEFAULT_FILE_LIMIT = 10_000 MAX_FILE_LIMIT = 100_000 )
View Source
const (
VOL_PREFIX_SECRET = "cl_secret:"
)
Variables ¶
View Source
var ( REAL_IP_HEADER = "X-Real-IP" FORWARDED_HEADER = "X-Forwarded-For" CONTENT_TYPE_JSON = []string{"application/json"} CONTENT_TYPE_TEXT = []string{"text/plain"} SERVER_NAME = []string{"OpenRun"} VARY_HEADER_VALUE = []string{"HX-Request"} )
Functions ¶
func AppFileOptions ¶ added in v0.15.2
func AppFileOptions() *syntax.FileOptions
func ClearCleanup ¶
ClearCleanup clears a defer function from the thread local
func CreatePluginApi ¶
func CreatePluginApi(f StarlarkFunction, opType PluginFunctionType) plugin.PluginFunc
func CreatePluginApiName ¶
func CreatePluginApiName( f func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error), opType PluginFunctionType, name string) plugin.PluginFunc
CreatePluginApiName creates a OpenRun plugin function
func CreatePluginConstant ¶
func CreatePluginConstant(name string, value starlark.Value) plugin.PluginFunc
func DeferCleanup ¶
DeferCleanup defers a close function to call when the API handler is done
func FetchPluginState ¶
FetchPluginState fetches a value from the thread local for the plugin
func NewFSPlugin ¶
func NewFSPlugin(pluginContext *types.PluginContext) (any, error)
func RegisterPlugin ¶
func RegisterPlugin(name string, builder plugin.NewPluginFunc, funcs []plugin.PluginFunc)
RegisterPlugin registers a plugin with OpenRun
Types ¶
type AccessType ¶
type AccessType string
const ( UserAccess AccessType = "user" AppAccess AccessType = "app" )
type App ¶
type App struct {
*types.Logger
*types.AppEntry
Name string
CustomLayout bool
// App config that takes default values from toml config, overridden with app level metadata.
// It is important that this property is used instead of reading from app metadata config, so that toml
// config defaults are applied.
AppConfig types.AppConfig
AppRunPath string // path to the app run directory
// contains filtered or unexported fields
}
App is the main object that represents a OpenRun app. It is created when the app is loaded
func NewApp ¶
func NewApp(sourceFS *appfs.SourceFs, workFS *appfs.WorkFs, logger *types.Logger, appEntry *types.AppEntry, systemConfig *types.SystemConfig, plugins map[string]types.PluginSettings, appConfig types.AppConfig, notifyClose chan<- types.AppPathDomain, secretEvalFunc func([][]string, string, string) (string, error), auditInsert func(*types.AuditEvent) error, serverConfig *types.ServerConfig, rbacApi rbac.RBACAPI) (*App, error)
type AppPlugins ¶
func NewAppPlugins ¶
func NewAppPlugins(app *App, pluginConfig map[string]types.PluginSettings, appAccounts []types.AccountLink) *AppPlugins
func (*AppPlugins) GetPlugin ¶
func (p *AppPlugins) GetPlugin(pluginInfo *plugin.PluginInfo, accountName string) (any, error)
type ByteWindow ¶ added in v0.15.5
type ByteWindow struct {
// contains filtered or unexported fields
}
func NewByteWindow ¶ added in v0.15.5
func NewByteWindow(windowSeconds int) *ByteWindow
func (*ByteWindow) Totals ¶ added in v0.15.5
func (bw *ByteWindow) Totals() (sent, recv uint64)
type ContainerHandler ¶ added in v0.15.20
type ContainerHandler struct {
*types.Logger
GenImageName container.ImageName // generated image name
// contains filtered or unexported fields
}
func NewContainerHandler ¶ added in v0.15.20
func NewContainerHandler(logger *types.Logger, app *App, containerFile string, serverConfig *types.ServerConfig, configPort int64, lifetime, scheme, health, buildDir string, sourceFS appfs.ReadableFS, paramMap map[string]string, containerConfig types.Container, stripAppPath bool, containerVolumes []string, secretsAllowed [][]string, cargs map[string]any) (*ContainerHandler, error)
func (*ContainerHandler) Close ¶ added in v0.15.20
func (h *ContainerHandler) Close() error
func (*ContainerHandler) DevReload ¶ added in v0.15.20
func (h *ContainerHandler) DevReload(ctx context.Context, dryRun bool) error
func (*ContainerHandler) GetEnvMap ¶ added in v0.15.20
func (h *ContainerHandler) GetEnvMap() (map[string]string, string)
func (*ContainerHandler) GetHealthUrl ¶ added in v0.15.20
func (h *ContainerHandler) GetHealthUrl(appHealthUrl string) string
func (*ContainerHandler) GetProxyUrl ¶ added in v0.15.20
func (h *ContainerHandler) GetProxyUrl() string
func (*ContainerHandler) ProdReload ¶ added in v0.15.20
func (h *ContainerHandler) ProdReload(ctx context.Context, dryRun bool) error
func (*ContainerHandler) WaitForHealth ¶ added in v0.15.20
func (h *ContainerHandler) WaitForHealth(attempts int, containerName container.ContainerName) error
type ContainerState ¶
type ContainerState string
const ( ContainerStateUnknown ContainerState = "unknown" ContainerStateRunning ContainerState = "running" ContainerStateIdleShutdown ContainerState = "idle_shutdown" ContainerStateHealthFailure ContainerState = "health_failure" )
type PluginFunctionType ¶
type PluginFunctionType int
const ( READ PluginFunctionType = iota WRITE READ_WRITE )
type PluginResponse ¶
type PluginResponse struct {
// contains filtered or unexported fields
}
PluginResponse is a starlark.Value that represents the response to a plugin request
func NewErrorCodeResponse ¶
func NewErrorCodeResponse(errorCode int, err error, value any) *PluginResponse
func NewErrorResponse ¶
func NewErrorResponse(err error, thread *starlark.Thread) *PluginResponse
func NewResponse ¶
func NewResponse(value any) *PluginResponse
func NewStreamResponse ¶
func NewStreamResponse(value any) *PluginResponse
func (*PluginResponse) AttrNames ¶
func (r *PluginResponse) AttrNames() []string
func (*PluginResponse) Freeze ¶
func (r *PluginResponse) Freeze()
func (*PluginResponse) Hash ¶
func (r *PluginResponse) Hash() (uint32, error)
func (*PluginResponse) String ¶
func (r *PluginResponse) String() string
func (*PluginResponse) Truth ¶
func (r *PluginResponse) Truth() starlark.Bool
func (*PluginResponse) Type ¶
func (r *PluginResponse) Type() string
func (*PluginResponse) UnmarshalStarlarkType ¶
func (r *PluginResponse) UnmarshalStarlarkType() (any, error)
type SSEMessage ¶
type SSEMessage struct {
// contains filtered or unexported fields
}
type StarlarkFunction ¶
type Tracker ¶ added in v0.15.5
type Tracker struct {
// contains filtered or unexported fields
}
Tracker is a reverse proxy with byte count tracking
func NewTracker ¶ added in v0.15.5
func NewTracker(proxy *httputil.ReverseProxy, windowSeconds int) *Tracker
func (*Tracker) GetRollingTotals ¶ added in v0.15.5
Accessor to read the rolling totals.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.