os-climate / physrisk-ui

UI for the Physical Risk tool
Apache License 2.0
5 stars 10 forks source link

Add platform backend uri from static file. #105

Open xbarra opened 1 month ago

xbarra commented 1 month ago

Co-authored-by: Arfima Dev dev@arfima.com Signed-off-by: Xavier Barrachina Civera xbarrachina@arfima.com

xbarra commented 1 month ago

The approach here is different than in the API,

The env variables configuration would be useful during the build, but (imho) you want to be able to use the same docker image regardless of where do you deploy.

By default the deployment has a BaseUris.js file in /app

In our deployment we use docker compose, the service is:

services:
  phyrkfront:
    <<: *common-net

    image: our.registry/clima/physrisk-ui:${phyrkfront_tag}
    restart: always

    secrets:
      - source: baseuris
        target: /app/BaseUris.js
secrets:
  baseuris:
    file: ./BaseUris.js

The contents of BaseUris,js is

window.BASE_API = 'https://our.example.com/api_prefix';

We could in that file add both the base_api and the options for Settings.js I have not done that yet here in case you don't like my approach.

Also, I am sorry, but I have no clue about openshift.

@joemoorhouse @redmikhail