Skip to content

Commit

Permalink
Provide log output when .env file is used - Closes #1155 (#2134)
Browse files Browse the repository at this point in the history
* Provide log output when `.env` file is used #1155

* Better wording with "Environment variables loaded...."
  • Loading branch information
Jolg42 committed Apr 8, 2020
1 parent 43a098a commit 852d4aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli/introspection/src/commands/Introspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Introspect implements Command {
!args['--url'] && schemaPath
? ` based on datasource defined in ${chalk.underline(path.relative(process.cwd(), schemaPath))}`
: ''
log(`Introspecting${basedOn} …`)
log(`\nIntrospecting${basedOn} …`)

const before = Date.now()
let introspectionSchema = ''
Expand Down
10 changes: 5 additions & 5 deletions cli/prisma2/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ if (process.argv.length > 2) {

if (fs.existsSync(args['--schema']) && fs.existsSync(dotenvFilepath)) {
dotenvResult = dotenv.config({ path: dotenvFilepath })
debug('.env loaded from provided --schema directory')
console.log(chalk.dim('Environment variables loaded from provided --schema directory'))
} else {
debug('.env not loaded (--schema was provided)')
debug('Environment variables not loaded (--schema was provided)')
}
} // Check current directory
else if (fs.existsSync('schema.prisma') && fs.existsSync('.env')) {
dotenvResult = dotenv.config()
debug('.env loaded from current directory')
console.log(chalk.dim('Environment variables loaded from current directory'))
} // Check ./prisma directory
else if (fs.existsSync('prisma/schema.prisma') && fs.existsSync('prisma/.env')) {
dotenvResult = dotenv.config({ path: 'prisma/.env' })
debug('.env loaded from ./prisma/.env')
console.log(chalk.dim('Environment variables loaded from ./prisma/.env'))
} // We didn't find a .env file next to the prisma.schema file.
else {
debug('.env not loaded')
debug('Environment variables not loaded')
}
// Print the error if any (if internal dotenv readFileSync throws)
if (dotenvResult && dotenvResult.error) {
Expand Down

0 comments on commit 852d4aa

Please sign in to comment.