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

Infer the config from the URL instead using the STUDY_NAME/STUDY_CONFIG environment variable #31

Open
shankari opened this issue Apr 17, 2023 · 1 comment

Comments

@shankari
Copy link
Contributor

At an even more basic level, in the public dashboard, the viz_scripts are run automatically in the background, so they cannot infer the study name from the URL (because they are not invoked via a URL). However, this is a webapp, so you have the URL, and should be able to infer the study name from the URL like the frontend of the public dashboard does.

https://github.com/e-mission/em-public-dashboard/blob/main/frontend/index.html#L354

This ensures that the code "just works" and avoids requiring a lot of configuration. You should be able to do something similar using https://dash.plotly.com/dash-core-components/location, which you do already get in
https://github.com/e-mission/op-admin-dashboard/pull/7/files#diff-9f23c8b13c9e75b67a44235089ab45e194bb00a6339db3295e9ff6a0646f2cc7R154

I agree that automatically inferring the values is less flexible, and I am open to including the CONFIG_PATH in the environment variables. But making the configuration uber flexible also opens us to subtle bugs caused by mismatched config settings. So I think the study name should be automatically inferred.

@shankari
Copy link
Contributor Author

Response from @AlirezaRa94

Now that we have STUDY_NAME in the docker-compose, we have the dynamic config before loading the dashboard layouts. But if we want to infer it from the URL, we need to get it in a request, and this happens after loading the dashboard, which will break everything. To solve this problem, we can add a welcome page and set the dynamic config at this time, and then we can load the dashboard. I'm also open to hearing your ideas on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant