Skip to content

Commit

Permalink
automatic create runtime environment
Browse files Browse the repository at this point in the history
  • Loading branch information
loeeeee committed Aug 6, 2024
1 parent 97cf1fc commit 9fad1c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
File renamed without changes.
33 changes: 28 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ set -xeuo pipefail # Make people's life easier
# -------------------
# Create env file if it does not exists
# -------------------
SCRIPT_DIR=$(dirname "$0")

create_local_env_file () {
create_install_env_file () {
# Check if env file exists
if [ ! -f .env ]; then
if [ ! -f $SCRIPT_DIR/.env ]; then
# If not, create a new one based on the template
if [ -f .env.template ]; then
cp .env.template .env
if [ -f $SCRIPT_DIR/install.env ]; then
cp install.env .env
echo "New .env file created from the template, exiting"
exit 0
else
Expand All @@ -21,7 +22,7 @@ create_local_env_file () {
fi
}

create_local_env_file
create_install_env_file

# -------------------
# Load environment variables from env file
Expand Down Expand Up @@ -329,6 +330,28 @@ EOF

create_custom_start_script

# -------------------
# Create runtime environment file
# -------------------

create_runtime_env_file () {
cd $INSTALL_DIR
# Check if env file exists
if [ ! -f runtime.env ]; then
# If not, create a new one based on the template
if [ -f $SCRIPT_DIR/runtime.env ]; then
cp $SCRIPT_DIR/runtime.env runtime.env
echo "New runtime.env file created from the template, exiting"
exit 0
else
echo "runtime.env not found, please clone the entire repo, exiting"
exit 1
fi
fi
}

create_runtime_env_file

# -------------------
# Cleanup
# -------------------
Expand Down
3 changes: 3 additions & 0 deletions runtime.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DB_USERNAME=immich
DB_PASSWORD=A_SEHR_SAFE_PASSWORD
DB_DATABASE_NAME=immich

0 comments on commit 9fad1c8

Please sign in to comment.