Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

494
Visualizações
How to manually set ENV variables when running rails console

Is there a way to pass in env variables when running rails console? I have a rails app running on a server and when I try to ssh in and run rails console for debugging it says it is missing the master key to decrypt the credentials. But the master key is set in the env variables as RAILS_MASTER_KEY and is definitely correct and working because the app is working normally and able to access the credentials.

Is there a way to run something like:

RAILS_MASTER_KEY=<master_key> rails console

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

From your console.

env RAILS_MASTER_KEY="..." rails c

See more here https://www.honeybadger.io/blog/ruby-guide-environment-variables/

over 4 years ago · Santiago Trujillo Relatório

0

The answer by @eyeslandic is generic and applicable to any shells.

But if you are using Bourne shell (bash) or Z-shell, your form should work actually:

RAILS_MASTER_KEY=<master_key> bin/rails console

A word of caution is that some characters contained in your master key may be interpreted by your Shell as something special. So, it is generally wise to quote the word with a pair of single quotations like

RAILS_MASTER_KEY='YOUR_MASTER_KEY' bin/rails console

If your master key contains a single quotation(s) or exclamation mark(s), it is slightly tricky. Refer to the reference of your shell about how to escape them, as it depends. Note that the same problem remains in the answer by @eyeslandic.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda