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

Proposal: Add Application Configuration Information #1159

Closed
chrisvdp opened this issue Mar 13, 2020 · 3 comments · Fixed by #1577
Closed

Proposal: Add Application Configuration Information #1159

chrisvdp opened this issue Mar 13, 2020 · 3 comments · Fixed by #1577

Comments

@chrisvdp
Copy link

First up, thanks for the great tool. It's saved me so much time over the years!

Problem
I need to see how my application is configured in production or other environments. This configuration information is stored in an URL encoded format in one or more <meta> tags in the <header> of my app. This config is not easily readable by humans in it's stored format.

Solution
Add an application configuration section. This could be added to the info section.

Details
The config for the current (3.17.0-beta.1) default output of ember-cli looks like this:

<meta name="my-app/config/environment" content="%7B%22modulePrefix%22%3A%22my-app%22%2C%22environment%22%3A%22development%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22my-app%22%2C%22version%22%3A%22v3.17.0-beta.1%2B7cbe9b8f%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D">

Not fun to read. It can be easily parsed by copying the contents and pasting them into JSON.parse(decodeURIComponent('encoded content here')), but this requires knowledge of the special command and is a bit cumbersome.

@chancancode
Copy link
Member

This seems like a great feature to me. However I think there are a few possible ways for an app to ship the config other than through the <meta> tag. @rwjblue do you happen to know if there is a single way (e.g. requiring a well know module path?) to get it reliably?

Copy link
Member

rwjblue commented May 19, 2020

Ya, you can require('app-name/config/environment') to get it. When using the <meta> that module is doing document.querySelector to read the value and parse it, when using storeConfigInMeta: false that module is literally the JS value you want.

@chrisvdp
Copy link
Author

I've been using the script

document.head.querySelectorAll("[name*='config/environment']").forEach(function(item) {
    console.log(JSON.parse(decodeURIComponent(item.content)))
})

which gets the config for the app and also mounted engines

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

Successfully merging a pull request may close this issue.

4 participants