feat: optional NPM proxy per stage

Add enable_proxy boolean to stages (default true). When disabled,
the deployer skips NPM proxy host creation — useful for internal
services, workers, or externally-routed containers. UI shows
toggle in Add Stage form and "No Proxy" badge on stage header.
This commit is contained in:
2026-03-29 12:58:13 +03:00
parent be6ad15efc
commit e94c4f9116
8 changed files with 71 additions and 40 deletions
+1
View File
@@ -21,6 +21,7 @@ export interface Stage {
auto_deploy: boolean;
max_instances: number;
confirm: boolean;
enable_proxy: boolean;
promote_from: string;
subdomain: string;
created_at: string;
+13 -2
View File
@@ -32,6 +32,7 @@
let stageName = $state('');
let stageTagPattern = $state('*');
let stageAutoDeploy = $state(true);
let stageEnableProxy = $state(true);
let stageMaxInstances = $state('1');
let addingStage = $state(false);
@@ -43,10 +44,11 @@
name: stageName.trim(),
tag_pattern: stageTagPattern.trim() || '*',
auto_deploy: stageAutoDeploy,
enable_proxy: stageEnableProxy,
max_instances: parseInt(stageMaxInstances) || 1,
});
toasts.success(`Stage "${stageName}" created`);
stageName = ''; stageTagPattern = '*'; stageAutoDeploy = true; stageMaxInstances = '1';
stageName = ''; stageTagPattern = '*'; stageAutoDeploy = true; stageEnableProxy = true; stageMaxInstances = '1';
showAddStage = false;
await loadProject();
} catch (e) {
@@ -338,7 +340,7 @@
{#if showAddStage}
<div class="mt-3 rounded-xl border border-[var(--border-primary)] bg-[var(--surface-card)] p-4 animate-scale-in">
<div class="grid grid-cols-2 gap-3 sm:grid-cols-4">
<div class="grid grid-cols-2 gap-3 sm:grid-cols-5">
<FormField label="Name *" name="stageName" bind:value={stageName} placeholder="dev" />
<FormField label="Tag Pattern" name="stagePattern" bind:value={stageTagPattern} placeholder="dev-*" helpText="Glob pattern (e.g., dev-*, v*)" />
<FormField label="Max Instances" name="stageMax" type="number" bind:value={stageMaxInstances} />
@@ -348,6 +350,12 @@
<ToggleSwitch bind:checked={stageAutoDeploy} label="Auto Deploy" />
</div>
</div>
<div class="flex flex-col gap-1.5">
<label class="text-sm font-medium text-[var(--text-primary)]">NPM Proxy</label>
<div class="flex items-center h-[38px]">
<ToggleSwitch bind:checked={stageEnableProxy} label="NPM Proxy" />
</div>
</div>
</div>
<div class="mt-3 flex justify-end">
<button
@@ -382,6 +390,9 @@
{#if stage.confirm}
<span class="rounded-full bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700">{$t('projectDetail.requiresConfirm')}</span>
{/if}
{#if !stage.enable_proxy}
<span class="rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-600">No Proxy</span>
{/if}
</div>
<div class="flex items-center gap-3">
<span class="text-xs text-[var(--text-tertiary)]">