fix: Dokploy saveEnvironment — use .env-style string + required fields (buildArgs, buildSecrets, createEnvFile)
This commit is contained in:
1 parent
fcf68626f8
commit
b3a36514d1
1 file changed
+8
-3
+8
-3
@@ -187,11 +187,16 @@ export function createDokployClient(config: DokployConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function saveEnvironment(applicationId: string, envVars: Record<string, string>): Promise<void> {
|
async function saveEnvironment(applicationId: string, envVars: Record<string, string>): Promise<void> {
|
||||||
// Dokploy expects env as array of { key, value } objects OR a JSON string
|
// Dokploy expects env as a .env-style string (KEY=value\nKEY2=value2)
|
||||||
const envArray = Object.entries(envVars).map(([key, value]) => ({ key, value }))
|
const envString = Object.entries(envVars)
|
||||||
|
.map(([key, value]) => `${key}=${value}`)
|
||||||
|
.join('\n')
|
||||||
await call('/application.saveEnvironment', {
|
await call('/application.saveEnvironment', {
|
||||||
applicationId,
|
applicationId,
|
||||||
env: JSON.stringify(envArray),
|
env: envString,
|
||||||
|
buildArgs: '[]',
|
||||||
|
buildSecrets: '[]',
|
||||||
|
createEnvFile: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user