Files
git.taskfile.build/bin/create-env
T
Janik von Rotz 43b5ab3a7c feat(task): update documentation and symlink instructions for default task file usage
- Add detailed instructions for setting up a default task file via symlink
- Include example bash function for prioritizing local task files
- Remove outdated alias recommendation from usage documentation
- Ensure clarity and consistency in integration guidelines
2025-11-27 17:13:53 +01:00

46 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
create-env() {
if [[ -z "$1" ]]; then echo "\$1 is empty."; exit; fi
if [[ -z "$2" ]]; then echo "\$1 is empty."; exit; fi
init-dotenv-dir
local env_filepath="$TASK_DOTENV_DIR/.env.$1"
if [[ -f "$env_filepath" ]]; then
echo "Env file already exists: $env_filepath"
exit 1
fi
echo "Init env file: $env_filepath"
if [[ "$2" == "odoo" ]]; then
echo "ODOO_URL=https://$1" > "$env_filepath"
echo "ODOO_DATABASE=$ODOO_DATABASE" >> "$env_filepath"
echo "ODOO_USERNAME=$ODOO_USERNAME" >> "$env_filepath"
echo "ODOO_PASSWORD=$ODOO_PASSWORD" >> "$env_filepath"
fi
if [[ "$2" == "nextcloud" ]]; then
echo "NEXTCLOUD_URL=" > "$env_filepath"
echo "NEXTCLOUD_USERNAME=" >> "$env_filepath"
echo "NEXTCLOUD_PASSWORD=" >> "$env_filepath"
fi
if [[ "$2" == "upgrade" ]]; then
echo "HOST='$1'" > "$env_filepath"
echo "SERVER='ALIAS.mint-system.com'" >> "$env_filepath"
echo "PORT=22" >> "$env_filepath"
echo "" >> "$env_filepath"
echo "ODOO_CONTAINER='odoo01'" >> "$env_filepath"
echo "ODOO_VERSION='16.0'" >> "$env_filepath"
echo "POSTGRES_CONTAINER='postgres01'" >> "$env_filepath"
echo "DATABASE='odoo'" >> "$env_filepath"
echo "" >> "$env_filepath"
echo "TARGET_ODOO_CONTAINER='odoo02'" >> "$env_filepath"
echo "TARGET_ODOO_VERSION='18.0'" >> "$env_filepath"
echo "TARGET_POSTGRES_CONTAINER='postgres02'" >> "$env_filepath"
echo "TARGET_DATABASE='upgrade'" >> "$env_filepath"
fi
echo "Edit with: task edit-env $1"
}