Khaled Boussoffara
Khaled Boussoffara

Reputation: 1771

Get Variable APPLICATION_ENV invalide, check .env file

I'm trying to deploy symfony project in my localhost using docker. my env file :

# Environment for old Zend projects, must be one of: 'development', 'preproduction' or 'production'
APPLICATION_ENV=development
# Database password for prod environment (optional)
PROD_DB_PASSWORD=
# Database password for preprod environment (optional)
PREPROD_DB_PASSWORD=postgres
# Username on prod and preprod servers for dump.sh, eg: 'jimmy_bailleux', 'vincent_robic' (optional)
DUMPSH_SSH_LOG=

I have a script in deploy.sh file :

.......
# Récuperation des variables de style
source ./shell/style.sh
source ./shell/function.sh
trap_error() {
    err_report $(caller) 

    # @TODO: Peut être vérifier que l'instance deploy_$project_name exist
    if [ "${APPLICATION_ENV}" == "production" ] || [ "${APPLICATION_ENV}" == "preproduction" ]; then
        if [ -n "$project_name" ]; then
            docker exec -i deploy_$project_name curl -X POST -H 'Content-type: application/json' --data '{"text":"Une erreur est survenu lors de la mise à jour du projet *_`'$project_name'`_* `'$APPLICATION_ENV'`"}' $slack_webhook
        fi
    fi

    docker rm -f deploy_$project_name
}
..... // 

The deploy launch script using the env variable : dev, preprod, prod .. I launched ./deploysh and i selected the number of my project. I got an error :

Variable APPLICATION_ENV invalide

enter image description here

Upvotes: 0

Views: 158

Answers (2)

Khaled Boussoffara
Khaled Boussoffara

Reputation: 1771

I fixed the problem by converting all sh files format to LF to resolve shll script ELO problem compatibility from MAC OS to Windows 10 and i put my DAMP folder to :

c:\Users\current_user

Upvotes: 0

Rekwian
Rekwian

Reputation: 152

Take care to your shell script EOL. It must be LF. also for your .env. :D

Upvotes: 1

Related Questions