-
-
Notifications
You must be signed in to change notification settings - Fork 512
Closed
Description
Steps to reproduce
- I started a fresh new Rails application using:
rails new . --api --database=postgresql
- I inserted dotenv-rails into the Gemfile:
group :development, :test do
gem 'dotenv-rails'
end
- I setup two environment file
.env.development
and.env.test
with:
DATABASE_URL=postgres://val@localhost/myapp_dev
and
DATABASE_URL=postgres://val@localhost/myapp_test
respectively.
- Run
rake db:create
.
Expected behavior
I am expecting rake db:create
to load .env.test
environment variable as pointed by the README.
Example:
Created database 'myapp_dev'
Created database 'myapp_test'
Actual behavior
But I get:
Created database 'myapp_dev'
ERROR: database "myapp_dev" already exists
STATEMENT: CREATE DATABASE "myapp_dev" ENCODING = 'unicode'
Database 'myapp_dev' already exists
As you can see, instead of creating the development and test database, it attempts to create the development database twice. Clearly, dotenv is ignoring the .env.test
.
System configuration
dotenv version:
2.2.1
Rails version:
5.1.0
Ruby version:
2.4.1
likeuwill
Metadata
Metadata
Assignees
Labels
No labels