Skip to content

Commit 85db8e5

Browse files
fix(setup): retain existing Compose Chat config
1 parent 1d73e9d commit 85db8e5

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

packages/deployment-config/src/env-capabilities.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,12 @@ export const DEPLOYMENT_CONFIGURATION_KEYS: readonly string[] = [
13391339
...new Set([
13401340
...CORE_CONFIGURATION_KEYS,
13411341
...ENV_CAPABILITIES.flatMap(capabilityKeys),
1342+
'COPILOT_API_KEY',
13421343
'EMAIL_VERIFICATION_ENABLED',
1344+
'NEXT_PUBLIC_CHAT_DISABLED',
13431345
'NEXT_PUBLIC_E2B_ENABLED',
13441346
'NEXT_PUBLIC_SANDBOXES_ENABLED',
1347+
'SIM_AGENT_API_URL',
13451348
...Object.values(LLM_KEY_POOLS).flatMap((pool) => [
13461349
...pool.keys,
13471350
...('fallbackKey' in pool ? [pool.fallbackKey] : []),

packages/sim-setup/src/configuration-sources.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,29 @@ describe('discoverConfigurationSources', () => {
8686
expect(sources[0].values?.get('RESEND_API_KEY')).toBe('current')
8787
})
8888

89+
it('retains Chat configuration from a prepared Compose .env file', () => {
90+
const root = temporaryDirectory()
91+
writeFileSync(
92+
path.join(root, '.env'),
93+
[
94+
'COPILOT_API_KEY=existing-chat-key',
95+
'NEXT_PUBLIC_CHAT_DISABLED=false',
96+
'SIM_AGENT_API_URL=https://copilot.example.com',
97+
].join('\n')
98+
)
99+
writeFileSync(
100+
path.join(root, 'docker-compose.prod.yml'),
101+
'services:\n simstudio:\n image: ghcr.io/simstudioai/simstudio:latest\n env_file: .env\n'
102+
)
103+
104+
const sources = discoverConfigurationSources({ root, runner: () => commandResult(1) })
105+
106+
expect(sources).toHaveLength(1)
107+
expect(sources[0].values?.get('COPILOT_API_KEY')).toBe('existing-chat-key')
108+
expect(sources[0].values?.get('NEXT_PUBLIC_CHAT_DISABLED')).toBe('false')
109+
expect(sources[0].values?.get('SIM_AGENT_API_URL')).toBe('https://copilot.example.com')
110+
})
111+
89112
it('uses the effective environment of a stopped Compose app container', () => {
90113
const parent = temporaryDirectory()
91114
const root = path.join(parent, 'checkout')

0 commit comments

Comments
 (0)