question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Environment variables can not load by Gemfile since v0.8.29.

See original GitHub issue

Hello. Now I am in trouble…

Up to 0.8.28, environment variables could be loaded in liquid by the following method. But, since 0.8.29, environmental variables can not be read by the above method.

My Gemfile


source 'https://rubygems.org/'

gem 'embulk-input-...'
gem 'embulk-filter-...'
...

gem 'dotenv'

begin
  require 'dotenv'
  Dotenv.load(File.expand_path('../../.env', __FILE__))
rescue LoadError => e
rescue => e
end

dotenv is a library that can manage environment variables with yaml.

My .env

DATABASE_HOST=localhost
DATABASE_USER=username
DATABASE_PASS=password
DATABASE_NAME=some_database

My liquid file

in:
  type: mysql
  host: {{ env.DATABASE_HOST }}
  user: {{ env.DATABASE_USER }}
  password: {{ env.DATABASE_PASS }}
  database: {{ env.DATABASE_NAME }}
  query: |
    select * from users limit 1

out:
  type: stdout

Run embulk

$ embulk run -b embulk_bundle config.yml

Did something change around environment variables?

It is running Gemfile on things like Digdag’s --params-file. https://docs.digdag.io/command_reference.html

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dmikurubecommented, Sep 15, 2017

@toyama0919 @toyama-h I think this issue would be worked-around by #790, which is released soon as v0.8.33. Can you try that?

1reaction
dmikurubecommented, Sep 1, 2017

@toyama0919 Thanks for your report! Got it… Since v0.8.29, JRuby instances not for plugins (e.g. subcommands, Liquid, Bundler, …) are independent from others to avoid creating (global) JRuby instances in the bootstrap.

Hmm…, let me think about that. That would be non-trivial to keep the un-JRuby’ed bootstrap.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment variable in Gemfile - ruby on rails - Stack Overflow
I have a heroku_env.rb file that's supposed to mock heroku's environment variables (and it's loaded in my application.rb ). Maybe that's not the ......
Read more >
bundle config - Bundler
Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set will cause it to ignore all configuration. Remembering Options. Flags passed to bundle ...
Read more >
Configuration - Rocket Programming Guide
Rocket applications can be configured via a configuration file, through environment variables, or both. Configurations are separated into three environments: ...
Read more >
Environment variables - Metabase
Environment variables Many settings in Metabase can be viewed and modified in the Admin Panel, or set via environment variables. The environment variables...
Read more >
Hiding Sensitive Information with Environmental Variables in ...
I ran into several issues with my app not loading after starting the server. Installing the dotenv with gem install dotenv did not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found