Skip to content

Instantly share code, notes, and snippets.

@frederickjh
Created March 5, 2018 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frederickjh/09ea8fa9cd0f377df2cf0bf26d440167 to your computer and use it in GitHub Desktop.
Save frederickjh/09ea8fa9cd0f377df2cf0bf26d440167 to your computer and use it in GitHub Desktop.
Fish shell function for generating hash_salt in a file for use with Drupal 8 websites.
function hashsalt --description 'Generate Drupal 8 hash salt in the current directory in the file, hash_salt.txt. Best to generate in composer project root and ignore in .gitignore. To use this file in settings.php use a line like: $settings[\'hash_salt\'] = file_get_contents(\'../hash_salt.txt\');'
drush eval "print_r(Drupal\Component\Utility\Crypt::randomBytesBase64(55))" > hash_salt.txt
echo 'hash_salt.txt has been generated. Best to generate in composer project root and ignore in .gitignore. To use this file in settings.php use a line like: $settings[\'hash_salt\'] = file_get_contents(\'../hash_salt.txt\');'
end
@frederickjh
Copy link
Author

frederickjh commented Mar 5, 2018

For those of you who are new to Fish shell, place this file at: ~/.config/fish/functions/hashsalt.fish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment