Skip to content

Commit

Permalink
Update add enviroment variable step to configure-server file
Browse files Browse the repository at this point in the history
  • Loading branch information
longbui98 committed Nov 5, 2023
1 parent 7f15594 commit b4cf993
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions .circleci/ansible/configure-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

# Get the environment variables from CircleCI and add to the EC2 instance
environment:
- TYPEORM_CONNECTION: "{{ lookup('env', 'TYPEORM_CONNECTION')}}"
- TYPEORM_ENTITIES: "{{ lookup('env', 'TYPEORM_ENTITIES')}}"
- TYPEORM_HOST: "{{ lookup('env', 'TYPEORM_HOST')}}"
- TYPEORM_CONNECTION: "{{ lookup('env.sample', 'TYPEORM_CONNECTION')}}"
- TYPEORM_ENTITIES: "{{ lookup('env.sample', 'TYPEORM_ENTITIES')}}"
- TYPEORM_HOST: "{{ lookup('env.sample', 'TYPEORM_HOST')}}"
- TYPEORM_PORT: 5432
- TYPEORM_USERNAME: "{{ lookup('env', 'TYPEORM_USERNAME')}}"
- TYPEORM_PASSWORD: "{{ lookup('env', 'TYPEORM_PASSWORD')}}"
- TYPEORM_DATABASE: "{{ lookup('env', 'TYPEORM_DATABASE')}}"
- TYPEORM_MIGRATIONS: "{{ lookup('env', 'TYPEORM_MIGRATIONS')}}"
- TYPEORM_MIGRATIONS_DIR: "{{ lookup('env', 'TYPEORM_MIGRATIONS_DIR')}}"
- TYPEORM_USERNAME: "{{ lookup('env.sample', 'TYPEORM_USERNAME')}}"
- TYPEORM_PASSWORD: "{{ lookup('env.sample', 'TYPEORM_PASSWORD')}}"
- TYPEORM_DATABASE: "{{ lookup('env.sample', 'TYPEORM_DATABASE')}}"
- TYPEORM_MIGRATIONS: "{{ lookup('env.sample', 'TYPEORM_MIGRATIONS')}}"
- TYPEORM_MIGRATIONS_DIR: "{{ lookup('env.sample', 'TYPEORM_MIGRATIONS_DIR')}}"
roles:
- configure-server
10 changes: 5 additions & 5 deletions .circleci/ansible/roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
cd /home/ubuntu
tar xvzf artifact.tar.gz -C .
- name: Add environment variable
become: true
shell: |
echo -e "NODE_ENV=local\nVERSION=1\nTYPEORM_CONNECTION=${TYPEORM_CONNECTION}\nTYPEORM_MIGRATIONS_DIR=${TYPEORM_MIGRATIONS_DIR}\nTYPEORM_ENTITIES=${TYPEORM_ENTITIES}\nTYPEORM_MIGRATIONS=${TYPEORM_MIGRATIONS}\nTYPEORM_HOST=${TYPEORM_HOST}\nTYPEORM_PORT=${TYPEORM_PORT}\nTYPEORM_USERNAME=${TYPEORM_USERNAME}\nTYPEORM_PASSWORD=${TYPEORM_PASSWORD}\nTYPEORM_DATABASE=${TYPEORM_DATABASE}"
>> /home/ubuntu/.env
# - name: Add environment variable
# become: true
# shell: |
# echo -e "NODE_ENV=local\nVERSION=1\nTYPEORM_CONNECTION=${TYPEORM_CONNECTION}\nTYPEORM_MIGRATIONS_DIR=${TYPEORM_MIGRATIONS_DIR}\nTYPEORM_ENTITIES=${TYPEORM_ENTITIES}\nTYPEORM_MIGRATIONS=${TYPEORM_MIGRATIONS}\nTYPEORM_HOST=${TYPEORM_HOST}\nTYPEORM_PORT=${TYPEORM_PORT}\nTYPEORM_USERNAME=${TYPEORM_USERNAME}\nTYPEORM_PASSWORD=${TYPEORM_PASSWORD}\nTYPEORM_DATABASE=${TYPEORM_DATABASE}"
# >> /home/ubuntu/.env

- name: "start server"
become: true
Expand Down

0 comments on commit b4cf993

Please sign in to comment.