github-copilot-resources / copilot-metrics-viewer

Tool to visualize the Copilot metrics provided via the Copilot Business Metrics API (current in public beta)
https://ashy-sky-02a7d0403.5.azurestaticapps.net/
MIT License
215 stars 99 forks source link

Configurable Variables #30

Open FijolaC opened 1 month ago

FijolaC commented 1 month ago

Hi,

We have encountered a problem where it is currently not possible to pass environment variables to a Docker container from outside. This seems to be due to the way the variables are integrated.

It would be much nicer if we could pass the variables through a separate environment file, such as a config.json.

Then, we could refer to the config.json when running npm serve, and in the Docker context, an environment variable or an env-file could be passed.

This would mean that no variables are required at build time.

Also, this approach would eliminate the need to constantly rebuild the container or run npm install, and it would be possible to provide one's own access token or other Vue variables at container start, without them being stored in the container during the build.

However, this would require adjusting how the variables are processed.

Thanks

DevOps-zhuang commented 1 month ago

So, is it possible to change the app to stateless applicaton so that all the information in .env are added during runtime? I used to create a similar application with python flask, will try it with copilot :-)

DevOps-zhuang commented 4 weeks ago

I did a quick try, replace .env with a new config.json file, and repalce 'process.env' with 'config', it seems it works since once the page refreshes, it will reload data from config.csv.

import config from '../assets/config.json' image

it works; and doubt the need to add one config page , so the .env files can be changed on UI.