Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCLOMRS-463: Passing OCL URL environment variables to run at runtime #357

Merged
merged 1 commit into from Mar 15, 2019

Conversation

judeinno
Copy link
Contributor

@judeinno judeinno commented Mar 13, 2019

JIRA TICKET NAME:

Passing OCL URL environment variables to run at runtime

Summary:

  • Create a bash script that creates an env-config.js file with key-value pairs of the environment variables.
  • Load env-config.js with the script tag in index.html
  • Update the start script in package.json to run the bash script when running the app during development.
  • Update the Dockerfile to copy the .env file, the bash script and also run the bash script before the build(at runtime). Then remove env-config.js from the public folder if any and add the newly created one by the bash script.

Testing.

In development

  • Create a .env file in the root directory and pass it;

OCL_API_HOST=https://api.qa.openconceptlab.org/
TRADITIONAL_OCL_HOST=https://qa.openconceptlab.org

  • Then run `npm start

In docker

  • ** Create a .env file in the root directory and pass it;

OCL_API_HOST=https://api.qa.openconceptlab.org/
TRADITIONAL_OCL_HOST=https://qa.openconceptlab.org

  • Then run docker build -t openmrs/ocl-client:local .
  • Wait for the build to finish, then run docker-compose -f docker/docker-compose.yml up to run the Docker container
  • Wait for the container to run, then access the app at http://localhost:8081/

@coveralls
Copy link

coveralls commented Mar 13, 2019

Pull Request Test Coverage Report for Build 2331

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 97.201%

Totals Coverage Status
Change from base Build 2321: -0.04%
Covered Lines: 1813
Relevant Lines: 1836

💛 - Coveralls

Dockerfile Outdated
RUN chmod +x init.sh

# Run the bash script
RUN /bin/bash -c ./init.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point of having the bash script is to run it at runtime in the CMD docker command (see the very bottom) and not during the build. We want to change environment properties AT RUNTIME using a pre-built image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me work on that

Copy link
Contributor Author

@judeinno judeinno Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed the issue.

@judeinno judeinno force-pushed the OCLOMRS-463 branch 2 times, most recently from d415c0b to 0798b86 Compare March 15, 2019 06:59
@dkayiwa dkayiwa merged commit 877f919 into openmrs:master Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants