Build Service / BuildPackage (push) Canceled after 0s
Group Actions and Config by category (Space-CLI, Bitcoin, Spaced, Subspaces, Certrelay, Nacho) and build x86 + arm only. Co-authored-by: Cursor <cursoragent@cursor.com>
103 lines
3.0 KiB
TypeScript
103 lines
3.0 KiB
TypeScript
import { storeJson } from '../fileModels/storeJson'
|
|
import { actionGroups } from '../actionGroups'
|
|
import { i18n } from '../i18n'
|
|
import { sdk } from '../sdk'
|
|
import {
|
|
CERTRELAY_DEFAULT_BOOTSTRAP,
|
|
CERTRELAY_DEFAULT_HEALTHCHECK_HANDLE,
|
|
CERTRELAY_DEFAULT_SELF_URL,
|
|
} from '../utils'
|
|
|
|
const { InputSpec, Value } = sdk
|
|
|
|
const inputSpec = InputSpec.of({
|
|
certrelaySelfUrl: Value.text({
|
|
name: i18n('Certrelay Self URL'),
|
|
description: i18n(
|
|
'The publicly visible URL clients use to reach this certrelay (CERTRELAY_SELF_URL). Set this to match the external address StartOS exposes for the Certrelay interface (e.g. your .onion or clearnet domain).',
|
|
),
|
|
warning: null,
|
|
footnote: null,
|
|
default: CERTRELAY_DEFAULT_SELF_URL,
|
|
required: true,
|
|
masked: false,
|
|
placeholder: 'https://certrelay.example.com',
|
|
minLength: 1,
|
|
maxLength: null,
|
|
}),
|
|
certrelayBootstrap: Value.toggle({
|
|
name: i18n('Certrelay Bootstrap'),
|
|
description: i18n(
|
|
'Whether this relay bootstraps from peer relays on startup (CERTRELAY_BOOTSTRAP).',
|
|
),
|
|
warning: null,
|
|
footnote: null,
|
|
default: CERTRELAY_DEFAULT_BOOTSTRAP,
|
|
}),
|
|
certrelayHealthcheckHandle: Value.text({
|
|
name: i18n('Certrelay Healthcheck Handle'),
|
|
description: i18n(
|
|
'A handle the bundled fabric CLI resolves against this relay to verify end-to-end health (CERTRELAY_HEALTHCHECK_HANDLE).',
|
|
),
|
|
warning: null,
|
|
footnote: null,
|
|
default: CERTRELAY_DEFAULT_HEALTHCHECK_HANDLE,
|
|
required: true,
|
|
masked: false,
|
|
placeholder: 'account-digital-useful.genesis@key',
|
|
minLength: 1,
|
|
maxLength: null,
|
|
}),
|
|
})
|
|
|
|
export const configureCertrelay = sdk.Action.withInput(
|
|
// id
|
|
'configure-certrelay',
|
|
|
|
// metadata
|
|
async ({ effects }) => ({
|
|
name: i18n('Configure Certrelay'),
|
|
description: i18n(
|
|
'Set the certrelay self URL, bootstrap toggle, and healthcheck handle. Saving restarts the service so certrelay picks up the new values.',
|
|
),
|
|
warning: null,
|
|
allowedStatuses: 'any',
|
|
group: actionGroups.certrelay,
|
|
visibility: 'enabled',
|
|
}),
|
|
|
|
// input
|
|
inputSpec,
|
|
|
|
// prefill — load current values from store
|
|
async ({ effects }) => {
|
|
const store = await storeJson.read().once()
|
|
return {
|
|
certrelaySelfUrl: store?.certrelaySelfUrl ?? CERTRELAY_DEFAULT_SELF_URL,
|
|
certrelayBootstrap:
|
|
store?.certrelayBootstrap ?? CERTRELAY_DEFAULT_BOOTSTRAP,
|
|
certrelayHealthcheckHandle:
|
|
store?.certrelayHealthcheckHandle ??
|
|
CERTRELAY_DEFAULT_HEALTHCHECK_HANDLE,
|
|
}
|
|
},
|
|
|
|
// run
|
|
async ({ effects, input }) => {
|
|
await storeJson.merge(effects, {
|
|
certrelaySelfUrl: input.certrelaySelfUrl,
|
|
certrelayBootstrap: input.certrelayBootstrap,
|
|
certrelayHealthcheckHandle: input.certrelayHealthcheckHandle,
|
|
})
|
|
|
|
return {
|
|
version: '1',
|
|
title: i18n('Success'),
|
|
message: i18n(
|
|
'Certrelay configuration saved. The service is restarting to apply the new settings.',
|
|
),
|
|
result: null,
|
|
}
|
|
},
|
|
)
|