Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I generate Rails SECRET_KEY_BASE without Ruby?

I'm wondering if there is a way to generate a Rails SECRET_KEY_BASE variable without having Ruby installed? All answers on SO I've seen point to using the SecureRandom library in Ruby.

This is fine, but my situation is a bit chicken and egg - I want to generate a file with a SECRET_KEY_BASE before I've built a Docker image with my Rails app. The base VM that the container runs in doesn't have Ruby installed.

It's Ubuntu 16.04 server and I'd install as little extra as possible (preferably just Docker!). It has Perl and OpenSSL installed. Could any of these be used?

like image 660
Steve Folly Avatar asked May 29 '17 18:05

Steve Folly


1 Answers

OK, I found out - using OpenSSL:

openssl rand -hex 64

like image 178
Steve Folly Avatar answered Sep 20 '22 14:09

Steve Folly