[Question] Can we read information from environment variables? #1144
-
We are building a Docker image with our API docs which is being used in multiple environments. Given that different environments have different URLs, we'd like to read the URL from an environment variable and use that in our docs without rebuild given it's a Docker image. Is that possible? What are the alternatives? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I would recommend using JavaScript to change things dynamically on load as Slate does not offer dynamic content out of the box as it's only really for static generation. You can embed the environment variable into the layout.erb using |
Beta Was this translation helpful? Give feedback.
I would recommend using JavaScript to change things dynamically on load as Slate does not offer dynamic content out of the box as it's only really for static generation. You can embed the environment variable into the layout.erb using
<%=ENV['foo'] %>
and if you want it in a markdown file, you can enable ERB (https://github.com/slatedocs/slate/wiki/Embedding-Ruby-in-Markdown).