ita-social-projects / dokazovi-be

The platform for verified medical speakers and their recommendations.
MIT License
13 stars 11 forks source link

[Docs] The application requires GOOGLE_CREDENTIALS environment variable to be set #395

Open handicraftsman opened 3 years ago

handicraftsman commented 3 years ago

Environment: GNU/Linux (KDE Neon) Reproducible: always Build found: Last commit at the develop branch, 2d09fbc3c5c213abf04a0a01ef7a94e1eb59f900.

GOOGLE_CREDENTIALS environment variable is always required for running or testing the application, even though this is not stated in the documentation.

Steps to reproduce

  1. Clone the repository
  2. Run ./gradlew bootRun or ./gradlew jacocoTestReport
  3. "Profit!"

Actual result The application crashes because the GOOGLE_CREDENTIALS environment variable is not set/

Expected result The application should start listening on the corresponding port or execute tests.

Workaround Set the GOOGLE_CREDENTIALS environment variable to a random value, e.g. noop.

Labels to be added "Bug", "fail", "backend"

Error in the log

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'googleAnalytics': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'GOOGLE_CREDENTIALS' in value "${GOOGLE_CREDENTIALS}"
handicraftsman commented 3 years ago

A proper fix seems to be editing analytics.creds in src/main/resources/application.properties. Testing right now.

analytics.creds=${GOOGLE_CREDENTIALS:noop}
handicraftsman commented 3 years ago

Yes, it works, although same change (of course) should be applied to src/test/resources/application.properties as well.