Build Service / BuildPackage (push) Has been cancelled
Remove the embedded explorer/indexer stack, switch subspaces to prebuilt images, add certrelay and nacho as always-on services, expose Spaces and Subs APIs, and wire optional HTTP basic auth for subs and subs-prover with the correct SUBS_BASIC_AUTH_PASSWORD env var. Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import { storeJson } from '../fileModels/storeJson'
|
|
import { i18n } from '../i18n'
|
|
import { sdk } from '../sdk'
|
|
import { randomPassword } from '../utils'
|
|
|
|
const DEFAULT_USERNAME = 'spaces'
|
|
|
|
export const enableSubsProverAuth = sdk.Action.withoutInput(
|
|
// id
|
|
'enable-subs-prover-auth',
|
|
|
|
// metadata
|
|
async ({ effects }) => {
|
|
const enabled = await storeJson.read((s) => s.subsProverAuthEnabled).once()
|
|
return {
|
|
name: i18n('Enable Subspaces Prover Auth'),
|
|
description: i18n(
|
|
'Turn on HTTP basic auth in front of the Subspaces Prover (port 8888). If no credentials have been set yet, a random password is generated (username defaults to "spaces"). Use "Show Subspaces Prover Auth Credentials" afterwards to retrieve them. Service restarts so subs-prover picks up the auth env vars.',
|
|
),
|
|
warning: null,
|
|
allowedStatuses: 'any',
|
|
group: null,
|
|
visibility: enabled === true ? 'hidden' : 'enabled',
|
|
}
|
|
},
|
|
|
|
// run
|
|
async ({ effects }) => {
|
|
const existing = await storeJson.read((s) => s.subsProverAuth).once()
|
|
const subsProverAuth = existing ?? {
|
|
username: DEFAULT_USERNAME,
|
|
password: randomPassword(),
|
|
}
|
|
|
|
await storeJson.merge(effects, {
|
|
subsProverAuth,
|
|
subsProverAuthEnabled: true,
|
|
})
|
|
|
|
return {
|
|
version: '1',
|
|
title: i18n('Success'),
|
|
message: existing
|
|
? i18n(
|
|
'Subspaces Prover Auth enabled with the existing stored credentials. The service is restarting; use "Show Subspaces Prover Auth Credentials" to view them.',
|
|
)
|
|
: i18n(
|
|
'Subspaces Prover Auth enabled and a fresh credential pair was generated. The service is restarting; use "Show Subspaces Prover Auth Credentials" to view them.',
|
|
),
|
|
result: null,
|
|
}
|
|
},
|
|
)
|