Bump the image to spacesops/spacesops:v1.0.1, always inject NODE_EXTRA_CA_CERTS from sdk.getSslCertificate so the upstream entrypoint no longer crashes on unset _SCRIPT_DIR, and document the same-host HTTPS behavior in the README. Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.7 KiB
TypeScript
66 lines
2.7 KiB
TypeScript
import { utils } from '@start9labs/start-sdk'
|
|
|
|
// The SpacesOps HTTP server. The app defaults to 127.0.0.1:3000; we override
|
|
// PLATFORM_HOST to 0.0.0.0 and PLATFORM_PORT to this so the StartOS reverse
|
|
// proxy can reach it.
|
|
export const uiPort = 7264
|
|
|
|
// Our own volume.
|
|
export const dataDir = '/data'
|
|
|
|
// Where the Spaces 'main' volume is mounted (read-only) so we can read the
|
|
// spaced RPC credentials Spaces seeded into its store.json.
|
|
export const spacesDataDir = '/spaces-data'
|
|
|
|
// The Spaces package this service depends on.
|
|
export const SPACES_PACKAGE_ID = 'spaces'
|
|
|
|
// Spaces exposes its spaced JSON-RPC as the `spaces-api` interface on 7225,
|
|
// reachable from a dependent package at this address.
|
|
export const SPACED_RPC_URL = 'http://spaces.startos:7225'
|
|
export const SPACED_WALLETLOAD_NAME = 'main'
|
|
|
|
// Admin Basic Auth is baked into the v1.0.1 image with NO env override. It
|
|
// cannot be changed without rebuilding the image. Surfaced (with a warning)
|
|
// via the "Show Admin Credentials" action.
|
|
export const ADMIN_USER = 'admin'
|
|
export const ADMIN_PASSWORD = 'Whatever!'
|
|
|
|
// Where StartOS writes the StartOS root CA for outbound *.startos HTTPS (see
|
|
// main.ts). Always injected as NODE_EXTRA_CA_CERTS — required on v1.0.1+ where
|
|
// the image entrypoint's setup-spacesops-env.sh references _SCRIPT_DIR without
|
|
// defining it under set -u.
|
|
export const nodeExtraCaCertVolumeSubpath = '.startos/startos-root-ca.crt'
|
|
export const nodeExtraCaCertContainerPath = `${dataDir}/.startos/startos-root-ca.crt`
|
|
|
|
// Legacy aliases (same file path after rename).
|
|
export const subsCaCertVolumeSubpath = nodeExtraCaCertVolumeSubpath
|
|
export const subsCaCertContainerPath = nodeExtraCaCertContainerPath
|
|
|
|
// Returns the hostname when url targets another StartOS service on this server
|
|
// (e.g. https://spaces.startos:7777), otherwise null.
|
|
export function startOsHostnameFromUrl(url: string): string | null {
|
|
try {
|
|
const hostname = new URL(url).hostname
|
|
return hostname.endsWith('.startos') ? hostname : null
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|
|
|
|
export const DEFAULT_OPERATOR_RELAY = 'wss://relay.primal.net'
|
|
export const DEFAULT_PLATFORM_MODE = 'prod'
|
|
export const DEFAULT_COINGECKO_TOKEN_COINS = 'bitcoin'
|
|
|
|
// 32 random bytes as a 64-char hex string — a secp256k1/Nostr secret key. The
|
|
// odds of an out-of-range key are ~1 in 2^128; if getPublicKey rejects it,
|
|
// init throws and StartOS retries with fresh entropy.
|
|
export function randomOperatorSecretHex(): string {
|
|
return utils.getDefaultString({ charset: '0-9,a-f', len: 64 })
|
|
}
|
|
|
|
// A strong replacement for the app's weak hardcoded PLATFORM_SESSION_SECRET.
|
|
export function randomSessionSecret(): string {
|
|
return utils.getDefaultString({ charset: 'a-z,A-Z,0-9', len: 48 })
|
|
}
|