Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
add --env-file to seed command. Closes #2269
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Jun 5, 2018
1 parent 426a4cf commit 03de277
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cli/packages/prisma-cli-core/src/commands/seed/seed.ts
Expand Up @@ -4,6 +4,7 @@ import { Importer } from '../import/Importer'
import { Seeder } from './Seeder'
import { prettyTime } from '../../util'
import chalk from 'chalk'
import * as path from 'path'

export default class Seed extends Command {
static topic = 'seed'
Expand All @@ -13,10 +14,20 @@ export default class Seed extends Command {
char: 'r',
description: 'Reset the service before seeding',
}),
['env-file']: flags.string({
description: 'Path to .env file to inject env vars',
char: 'e',
}),
}
async run() {
const { reset } = this.flags
await this.definition.load(this.flags)
const envFile = this.flags['env-file']

if (envFile && !fs.pathExistsSync(path.join(this.config.cwd, envFile))) {
await this.out.error(`--env-file path '${envFile}' does not exist`)
}

await this.definition.load(this.flags, envFile)
const serviceName = this.definition.service!

const cluster = this.definition.getCluster()
Expand Down

0 comments on commit 03de277

Please sign in to comment.