Documentation
¶
Overview ¶
Package apps hosts the `olares-cli settings apps ...` subtree.
common.go centralizes the per-area Doer + output plumbing in the same shape as cli/cmd/ctl/settings/me/common.go and cli/cmd/ctl/settings/users/common.go. These tiny helpers stay per-area rather than being hoisted to a shared package because each area accumulates its own response-shape quirks; the cost of a small per-area common.go is much smaller than churning an over-abstracted shared helper.
Package apps implements the `olares-cli settings apps` subtree (Settings -> Applications). This is the largest sub-tree by verb count: the SPA's per-app pages drive lifecycle (suspend/resume/uninstall), entrance + domain config, and per-app env. Backed by user-service's app.controller.ts / application.controller.ts / bfl/application.controller.ts / bfl/env.controller.ts.
Lifecycle verbs (suspend / resume / uninstall) live here rather than under `market` because the underlying API is on the Settings desktop ingress, not the per-user market endpoint — see plan.md's "Settings vs Market" disambiguation.
Index ¶
- func NewAppsCommand(f *cmdutil.Factory) *cobra.Command
- func NewAuthLevelCommand(f *cmdutil.Factory) *cobra.Command
- func NewDomainCommand(f *cmdutil.Factory) *cobra.Command
- func NewEntrancesCommand(f *cmdutil.Factory) *cobra.Command
- func NewEnvCommand(f *cmdutil.Factory) *cobra.Command
- func NewGetCommand(f *cmdutil.Factory) *cobra.Command
- func NewListCommand(f *cmdutil.Factory) *cobra.Command
- func NewPolicyCommand(f *cmdutil.Factory) *cobra.Command
- func NewResumeCommand(f *cmdutil.Factory) *cobra.Command
- func NewSuspendCommand(f *cmdutil.Factory) *cobra.Command
- type Doer
- type EntrancePolicy
- type Format
- type SetupDomain
- type SetupPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAppsCommand ¶
NewAppsCommand returns the `settings apps` parent: lifecycle (suspend / resume), per-app env, and per-app entrance config (entrances list, domain, policy, auth-level).
func NewAuthLevelCommand ¶
NewAuthLevelCommand returns the `settings apps auth-level` parent. Single-verb but we still nest it under a parent so the help text has somewhere to land — and so a future `auth-level get` (if the upstream ever exposes one) has a natural home.
func NewDomainCommand ¶
NewDomainCommand returns the `settings apps domain` parent.
func NewEntrancesCommand ¶
NewEntrancesCommand returns the `settings apps entrances` parent. Only `list` lives here; the per-entrance setup verbs live as top-level commands (`apps domain`, `apps policy`, `apps auth-level`) rather than nested under `entrances` because the SPA flattens them into separate side-panels rather than nesting under a single "entrance" tab.
func NewGetCommand ¶
`olares-cli settings apps get <name>`
There is no per-app "get" endpoint in user-service or BFL — the SPA's Application detail page reads a single record from the in-memory list it loaded from /api/myapps (see ApplicationDetailPage.vue's reliance on `applicationStore.applications.find(...)`). We follow the same model: fetch the full list, filter by name, and render a single record.
The trade-off: each `apps get` call pays the cost of a list fetch. That's fine for an interactive CLI (the full list is small — typically dozens of apps, not thousands), and it sidesteps having to keep two separate decoders for "list" and "single" payload shapes.
Role: any authenticated user; no preflight.
func NewListCommand ¶
`olares-cli settings apps list`
Wraps user-service's GET /api/myapps (init.controller.ts:52).
Server flow:
user-service /api/myapps → AppService.GetMyApps() →
BFL /bfl/backend/v1/myapps (POST internally) → returns
`{code: 0, data: {items: [AppInfo, ...]}}`. user-service unwraps
`data.data.items` into AppInfo[] and re-wraps with returnSucceed,
so the CLI receives a plain BFL envelope wrapping the array:
{ "code": 0, "message": "Success", "data": [AppInfo, ...] }
Note: this is the same SPA call surface the Settings UI uses to populate "Settings -> Apps". It overlaps in data with `olares-cli market list` but the focus is different: market is about install lifecycle (versions, sources), settings apps is about post-install configuration (entrances, ports, owner). We keep both surfaces because the SPA does too.
Role: any authenticated user can list their own apps; no preflight.
func NewPolicyCommand ¶
NewPolicyCommand returns the `settings apps policy` parent.
func NewResumeCommand ¶
NewResumeCommand returns `settings apps resume <name>`.
Types ¶
type Doer ¶
type Doer interface {
DoJSON(ctx context.Context, method, path string, body, out interface{}) error
}
Doer is the smallest contract verbs need from the underlying HTTP client. *whoami.HTTPClient satisfies it.
type EntrancePolicy ¶
type EntrancePolicy struct {
OneTime bool `json:"one_time"`
Policy string `json:"policy"`
URI string `json:"uri"`
ValidDuration int `json:"valid_duration"`
}
EntrancePolicy mirrors the SPA's EntrancePolicy interface (apps/.../constant/index.ts:187-192) — a single sub-policy row.
type SetupDomain ¶
type SetupDomain struct {
ThirdLevelDomain string `json:"third_level_domain"`
ThirdPartyDomain string `json:"third_party_domain"`
CnameStatus string `json:"cname_status,omitempty"`
CnameTarget string `json:"cname_target,omitempty"`
CnameTargetStatus string `json:"cname_target_status,omitempty"`
Cert string `json:"cert,omitempty"`
Key string `json:"key,omitempty"`
}
SetupDomain mirrors the GET response payload for the /api/applications/<app>/<entrance>/setup/domain endpoint.
type SetupPolicy ¶
type SetupPolicy struct {
DefaultPolicy string `json:"default_policy"`
OneTime bool `json:"one_time"`
ValidDuration int `json:"valid_duration"`
SubPolicies []EntrancePolicy `json:"sub_policies"`
}
SetupPolicy mirrors the GET /setup/policy response. sub_policies can be either nil OR an array; the SPA treats nil + [] interchangeably.