Files
dokploy/packages/server/src/utils/builders/utils.ts
Mauricio Siu a0d9f06a35 fix(logs): ensure safe access to service error in ShowDockerLogs component
- Updated the ShowDockerLogs component to use optional chaining when accessing the error property of services, preventing potential runtime errors.
- Refactored the deployApplication function to create an applicationEntity object, ensuring consistent use of serverId across repository cloning functions.
- Removed unused createEnvFile function from utils, streamlining the codebase.
2026-02-07 23:34:35 -06:00

21 lines
564 B
TypeScript

import { dirname, join } from "node:path";
import { encodeBase64, prepareEnvironmentVariables } from "../docker/utils";
export const createEnvFileCommand = (
directory: string,
env: string | null,
projectEnv?: string | null,
environmentEnv?: string | null,
) => {
const envFileContent = prepareEnvironmentVariables(
env,
projectEnv,
environmentEnv,
).join("\n");
const encodedContent = encodeBase64(envFileContent || "");
const envFilePath = join(dirname(directory), ".env");
return `echo "${encodedContent}" | base64 -d > "${envFilePath}";`;
};