-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·36 lines (36 loc) · 1.73 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -e
if [ -f "./.env" ]; then
echo ".env file already exists. Exiting to avoid changing secrets. Edit the file directly instead."
exit 1
fi
echo 'Creating .env settings file'
cat ./.env.defaults > ./.env
echo 'Generating secret keys.'
sessionSecret=$(openssl rand -base64 32)
easySecret=$(openssl rand -base64 32)
sed -Ei "s|(sessionSecret=).*|\1$sessionSecret|" ./.env
sed -Ei "s|(easySecret=).*|\1$easySecret|" ./.env
echo 'Please answer the following prompts to configure your immer.'
echo 'Visit https://github.com/immers-space/immers-app for more info.'
read -p 'Name of your immer (e.g. Immers Space): ' immerName
sed -Ei "s|(name=).*|\1$immerName|" ./.env
read -p 'Base domain for your immer (e.g. immers.space): ' domain
sed -Ei "s|(domain=).*|\1$domain|" ./.env
read -p 'Domain for your Mozilla Hubs Cloud: ' hub
sed -Ei "s|(hub=).*|\1$hub|" ./.env
read -p 'Admin email for your Mozilla Hubs Cloud: ' email
sed -Ei "s|(email=).*|\1$email|" ./.env
read -p 'Domain for your smtp email service: ' smptHost
sed -Ei "s|(smptHost=).*|\1$smptHost|" ./.env
read -p 'Port for your smtp email service (default 587): ' smptPort
[ -z "$smptPort" ] || sed -Ei "s|(smptPort=).*|\1$smptPort|" ./.env
read -p 'Username for your smtp email service: ' smtpUser
sed -Ei "s|(smtpUser=).*|\1$smtpUser|" ./.env
read -p 'Password for your smtp email service: ' smtpPassword
sed -Ei "s|(smtpPassword=).*|\1$smtpPassword|" ./.env
sed -Ei "s|(smtpFrom=noreply@mail\.).*|\1$domain|" ./.env
# create host directory for static theme files
mkdir -p ~/immers
echo 'Your immer is configured. Additional options are available by editing the .env file. It is a good idea download a backup copy of this file.'
echo 'Start your immer with the command "docker-compose up -d"'