mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 06:31:58 +00:00
Generate random JWT_SECRET value in install.sh
This commit is contained in:
parent
00549eed79
commit
9869b92c2b
1 changed files with 19 additions and 14 deletions
33
install.sh
33
install.sh
|
@ -18,33 +18,37 @@ get_release_version() {
|
|||
create_immich_directory() {
|
||||
echo "Creating Immich directory..."
|
||||
mkdir -p ./immich-app/immich-data
|
||||
cd ./immich-app
|
||||
}
|
||||
|
||||
download_docker_compose_file() {
|
||||
echo "Downloading docker-compose.yml..."
|
||||
curl -L https://raw.githubusercontent.com/immich-app/immich/$release_version/docker/docker-compose.yml -o ./immich-app/docker-compose.yml >/dev/null 2>&1
|
||||
curl -L https://raw.githubusercontent.com/immich-app/immich/$release_version/docker/docker-compose.yml -o ./docker-compose.yml >/dev/null 2>&1
|
||||
}
|
||||
|
||||
download_dot_env_file() {
|
||||
echo "Downloading .env file..."
|
||||
curl -L https://raw.githubusercontent.com/immich-app/immich/$release_version/docker/.env.example -o ./immich-app/.env >/dev/null 2>&1
|
||||
curl -L https://raw.githubusercontent.com/immich-app/immich/$release_version/docker/.env.example -o ./.env >/dev/null 2>&1
|
||||
}
|
||||
|
||||
replace_env_value() {
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' "s|$1=.*|$1=$2|" ./.env
|
||||
else
|
||||
sed -i "s|$1=.*|$1=$2|" ./.env
|
||||
fi
|
||||
}
|
||||
|
||||
populate_upload_location() {
|
||||
echo "Populating default UPLOAD_LOCATION value..."
|
||||
upload_location=$(pwd)/immich-data
|
||||
replace_env_value "UPLOAD_LOCATION" $upload_location
|
||||
}
|
||||
|
||||
cd ./immich-app/immich-data
|
||||
|
||||
upload_location=$(pwd)
|
||||
|
||||
# Replace value of UPLOAD_LOCATION in .env with upload_location path
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' "s|UPLOAD_LOCATION=.*|UPLOAD_LOCATION=$upload_location|" ../.env
|
||||
else
|
||||
sed -i "s|UPLOAD_LOCATION=.*|UPLOAD_LOCATION=$upload_location|" ../.env
|
||||
fi
|
||||
|
||||
cd ..
|
||||
generate_jwt_secret() {
|
||||
echo "Generating JWT_SECRET value..."
|
||||
jwt_secret=$(openssl rand -base64 128)
|
||||
replace_env_value "JWT_SECRET" $jwt_secret
|
||||
}
|
||||
|
||||
start_docker_compose() {
|
||||
|
@ -88,4 +92,5 @@ create_immich_directory
|
|||
download_docker_compose_file
|
||||
download_dot_env_file
|
||||
populate_upload_location
|
||||
generate_jwt_secret
|
||||
start_docker_compose
|
||||
|
|
Loading…
Reference in a new issue