Database.yml with environment from dotenv

Hello there,

Is it just me or is there an issue with RubyMine not loading the environment variables from the dotenv.
Everytime I open/restart RubyMine my settings are lost. I guess they are reloaded from database.yml
See attached screenshot:
Bildschirmfoto1.png
My .env looks like this:

DB_PASS=awesome_sauce
DB_NAME=rms2
APPLICATION=both


Writing that values directly into the fields is working. But at the next start of RubyMine the configuration is lost.
Is there a known workaround?

9 comments
Comment actions Permalink

Hi,

RubyMine doesn't load .env, it uses environment you have when you run RubyMine.

Michels wrote:
 
Writing that values directly into the fields is working. But at the next start of RubyMine the configuration is lost.
Is there a known workaround?

Could you please clarify the situation you have.  I'd expect that data soure should be kept untouched if a user creates one.
If RM does remove such data sources I'd consider this as a bug and tried to fix it.

Regards, Oleg.

0
Comment actions Permalink

RubyMine doesn't load .env, it uses environment you have when you run RubyMine.

Well that's ok, I could write it in my RubyMine startup environment. But as you can see the environment is not replaced. There's still the plain ERB-Syntax <%= ENV['DB_HOST'] %>.

I'd expect that data source should be kept untouched if a user creates one.

If RM does remove such data sources I'd consider this as a bug and tried to fix it.


That's exactly the case.They are not removed but replaced with what's in database.yml

Steps to reproduce:
1. Start RubyMine
2. Enter Data Sources (Host, DB, Username, Password)
3. Everything works as expected
4. Close RubyMine
5. Start RubyMine
6. Data Source has invalid values. So no access is possible. Settings look like in the first screen shot. If I open a table: "The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
java.net.UnknownHostException: <%= ENV['DB_HOST'] %>"


I think there are 2 issues here:
1. The ERB is not evaluated.
2. The user provided settings are not stored.

0
Comment actions Permalink

Ah, I've missed this.  The configuration doesn't support erb :(

Oleg.

0
Comment actions Permalink
I'd expect that data source should be kept untouched if a user creates one.

Is this point still valid?

0
Comment actions Permalink

Yes, this is what I'd espect as a user.

Regards, Oleg.

0
Comment actions Permalink

So just to follow up:

You would consider this a bug?
Are there any plans to fix this?

Oh and just for reference. Some one else had the problem, too: https://devnet.jetbrains.com/thread/460488

0
Comment actions Permalink

+1

I have the same problem. I think it's going to force me to choose between dotenv and RubyMine. I guess I'll choose RubyMine, but I'm kind of bummed about it.

0
Comment actions Permalink

+1

Have the same problem too.

0

Please sign in to leave a comment.