config: auto generate secret key if none given.
Automatically generate a random secret key for `Danbooru.config.secret_key_base`
if no key is specified.
This so that you can run Danbooru in a Docker container with zero
configuration.
This removes support for the ~/.danbooru/secret_token file and the
SECRET_TOKEN environment variable. If you used either one of these, you
must copy the value either to DANBOORU_SECRET_KEY_BASE in .env.local, or to
`secret_key_base` in config/danbooru_local_config.rb.
# .env.local
DANBOORU_SECRET_KEY_BASE=<value>
# config/danbooru_local_config.rb
def secret_key_base
# <value>
end
This commit is contained in:
@@ -100,13 +100,6 @@ sudo -u danbooru git clone git://github.com/sstephenson/ruby-build.git ~danbooru
|
||||
sudo -u danbooru bash -l -c "RUBY_CONFIGURE_OPTS=--disable-install-doc rbenv install --verbose $RUBY_VERSION"
|
||||
sudo -u danbooru bash -l -c "rbenv global $RUBY_VERSION"
|
||||
|
||||
# Generate secret token and secret key
|
||||
echo "* Generating secret keys..."
|
||||
sudo -u danbooru mkdir ~danbooru/.danbooru/
|
||||
sudo -u danbooru sh -c 'openssl rand -hex 32 > ~danbooru/.danbooru/secret_token'
|
||||
sudo -u danbooru sh -c 'openssl rand -hex 32 > ~danbooru/.danbooru/session_secret_key'
|
||||
chmod 600 ~danbooru/.danbooru/*
|
||||
|
||||
# Install gems
|
||||
echo "* Installing gems..."
|
||||
sudo -u danbooru bash -l -c 'gem install --no-ri --no-rdoc bundler'
|
||||
|
||||
Reference in New Issue
Block a user