Last active
October 1, 2018 20:35
-
-
Save weaver299/3b8b73f5022b29f36d22dee0ec7eb900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gen_dev_config() { | |
if [[ -z "$1" ]]; then | |
echo "Usage: gen_site_config <site_name>"; | |
echo; | |
return 1; | |
fi | |
password=$(</dev/urandom tr -dc '0-9!@#$%a-zA-Z' | head -c16; echo ""); | |
underscores=$(echo "$1" | sed 's/\./_/g' | sed 's/-//g'); | |
dev_underscores=$(echo "dev_$underscores"); | |
inc_filename=$(echo "dev.$1.inc" ); | |
cat << _EOF >> create_databases.sql | |
create database $dev_underscores; | |
grant all on $dev_underscores.* to $dev_underscores@'%' identified by '$password'; | |
_EOF | |
cat << _EOF > $inc_filename | |
<?php | |
$databases['default']['default'] = array ( | |
'database' => '$dev_underscores', | |
'username' => '$dev_underscores', | |
'password' => '$password', | |
'prefix' => '', | |
'host' => 'dev.asdfasdf.us-west-2.rds.amazonaws.com', | |
'port' => 3306, | |
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', | |
'driver' => 'mysql', | |
); | |
$conf["file_public_path"] = "sites/$1/files"; | |
$conf["file_private_path"] = "sites/$1/private"; | |
$conf["file_temporary_path"] = "sites/$1/tmp"; | |
_EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment