天道酬勤,学无止境

ruby-dotenv

dotenv gem doesn't get variables in Rails 6 or Ruby 2.6.5

I was using the dotenv gem to store environmental variables for development in a secrets file. The gem is no longer pulling the variables after upgrading ruby and rails on my computer. To try and track down the cause, and after a while of trying different options, I ended up creating two identical applications with just two differences. The ruby and the rails versions. One app is able to pull the environmental variables, the other returns nil. Any suggestions? My Setup Working application has ruby "2.5.0" gem 'rails', '~> 5.1.6' Non-working app has ruby "2.6.5" gem 'rails', '~> 6.0.0' What I

2022-04-04 14:52:13    分类:问答    environment-variables   ruby-on-rails-6   ruby-dotenv

Is it possible to store a JSON file to an ENV variable with dotenv?

I am using Google Drive API with my Rails application. The API is working fine. I have the following client_secret.json file: { "type": "service_account", "project_id": "gobirdie-landing-page", "private_key_id": "xxxxx", "private_key": "-----BEGIN PRIVATE KEY----- xxxxx -----END PRIVATE KEY-----\n", "client_email": "xxxxxxx@gobirdie-landing-page.iam.gserviceaccount.com", "client_id": "xxxxxxxxx", "auth_uri": "xxxxxx", "token_uri": "xxxxxxx": "xxxxxxxx": "xxxxxxxxx" } which is called in my controller @session = GoogleDrive::Session.from_service_account_key("client_secret.json") With this

2021-06-02 02:41:06    分类:问答    ruby-on-rails   json   ruby-dotenv