Skip to content

Commit a279d8b

Browse files
committed
feat: add --file option to shipnode env command
Allows uploading a specific .env file instead of the default from config.
1 parent 7c26451 commit a279d8b

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/cli/commands/env.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ import { ui } from '../ui.js';
66

77
export async function cmdEnv(
88
cwd: string,
9-
options: { config?: string },
9+
options: { file?: string; config?: string },
1010
): Promise<void> {
1111
await runRemoteCommand(
1212
cwd,
1313
async ({ config, executor }) => {
14-
const localEnvPath = resolve(cwd, config.envFile);
14+
const envFile = options.file ?? config.envFile;
15+
const localEnvPath = resolve(cwd, envFile);
1516

1617
if (!(await pathExists(localEnvPath))) {
17-
throw new Error(`Environment file not found: ${config.envFile}`);
18+
throw new Error(`Environment file not found: ${envFile}`);
1819
}
1920

20-
ui.info(`Uploading ${config.envFile} to server...`);
21+
ui.info(`Uploading ${envFile} to server...`);
2122

2223
const content = await readFile(localEnvPath);
2324
const b64 = content.toString('base64');

src/cli/commands/help.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ${chalk.bold('RELEASE MANAGEMENT')}
2020
${chalk.green('migrate')} Migrate existing deploy to zero-downtime structure
2121
2222
${chalk.bold('ENVIRONMENT')}
23-
${chalk.green('env')} Upload local .env file to the server
23+
${chalk.green('env')} [--file <p>] Upload local .env file to the server
2424
${chalk.green('run')} <cmd> Run a one-off command on the production server
2525
2626
${chalk.bold('PROCESS MANAGEMENT')}

src/cli/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ program
8888
program
8989
.command('env')
9090
.description('Upload local .env file to the server')
91+
.option('--file <path>', 'Path to .env file to upload (default: .env from config)')
9192
.option('--config <path>', 'Use a specific config file')
9293
.action((opts) => cmdEnv(process.cwd(), opts));
9394

0 commit comments

Comments
 (0)