openclaw

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 6 Imported by: 0

README

OpenClaw Package

Origin allowlist approach (allowedOrigins)

We use gateway.controlUi.allowedOrigins in openclaw.json per OpenClaw docs. This is the recommended way (same as docker-setup.sh's ensure_control_ui_allowed_origins).

How it works
  1. Initial boot (exec.go user-data): Container starts with allowedOrigins: ["http://127.0.0.1:<port>"]. CloudFront doesn't exist yet, but localhost is enough for health checks and SSM port-forward access.
  2. Post-deploy (exec.go after MaybeEnsureHTTPSViaCloudFront): Once the CloudFront domain is known, SSM patches openclaw.json to add "https://<cf-domain>" and restarts the container.
  3. SSM restart / re-bootstrap (openclaw.go, postdeploy_autofix.go): Uses ConfigWriteShellCmd(cfDomain, port) which reads CLOUDFRONT_DOMAIN from bindings and includes it if available.
Config written
{
    "gateway": {
        "mode": "local",
        "controlUi": {
            "allowedOrigins": [
                "http://127.0.0.1:18789",
                "https://d1234abcdef.cloudfront.net"
            ]
        }
    }
}
Key functions
  • ConfigJSON(cfDomain, port) — returns the JSON config string
  • ConfigWriteShellCmd(cfDomain, port) — returns the shell command to write it via alpine init container
Legacy cleanup

The --dangerously-allow-host-header-origin-fallback CLI flag is stripped from start commands if found (backward compat with old plans).

References

Documentation

Index

Constants

View Source
const DefaultPort = 18789

Variables

This section is empty.

Functions

func ConfigJSON

func ConfigJSON(cfDomain string, port int) string

ConfigJSON returns the openclaw.json config with proper origin allowlist. Always includes localhost; if cfDomain is non-empty, adds the HTTPS origin.

func ConfigWriteShellCmd

func ConfigWriteShellCmd(cfDomain string, port int) string

ConfigWriteShellCmd returns a shell command that writes openclaw.json via an alpine init container.

func ContainerName

func ContainerName(bindings map[string]string) string

func Detect

func Detect(question string, repoURL string) bool

func MaybePrintPostDeployInstructions

func MaybePrintPostDeployInstructions(bindings map[string]string, profile, region string, w io.Writer, question, repoURL string)

func SSMRestartCommands

func SSMRestartCommands(prelude []string, port int, image string, startCmd string, bindings map[string]string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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