35 lines
1.1 KiB
Bash
Executable File
35 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Function to update configuration files
|
|
update_config() {
|
|
local env_file=".env"
|
|
local nginx_conf="configs/nginx/nginx.conf"
|
|
local php_ini="configs/php/php.ini"
|
|
|
|
# Update nginx.conf
|
|
if [ -f "$env_file" ] && [ -f "$nginx_conf" ]; then
|
|
while IFS='=' read -r key value; do
|
|
if [[ $key == NGINX_* ]]; then
|
|
# Remove NGINX_ prefix and convert to lowercase
|
|
setting=${key#NGINX_}
|
|
setting=${setting,,}
|
|
# Update nginx.conf
|
|
sed -i "s|^[[:space:]]*$setting[[:space:]]*.*|$setting $value;|g" "$nginx_conf"
|
|
fi
|
|
done < "$env_file"
|
|
fi
|
|
|
|
# Update php.ini
|
|
if [ -f "$env_file" ] && [ -f "$php_ini" ]; then
|
|
while IFS='=' read -r key value; do
|
|
if [[ $key != NGINX_* ]]; then
|
|
# Convert underscores to dots for PHP settings
|
|
setting=${key//_/.}
|
|
# Update php.ini
|
|
sed -i "s|^[[:space:]]*$setting[[:space:]]*=.*|$setting = $value|g" "$php_ini"
|
|
fi
|
|
done < "$env_file"
|
|
fi
|
|
}
|
|
|
|
update_config |