<p>I have an Angular app where the <code>environment.ts</code> file is hard coded with the <code>baseURL</code> like below. The backend service is also deployed in same cluster and accessible with a service name.</p>
<pre class="lang-js prettyprint-override"><code>export const environment = {
  production: true,
  baseURL: 'http://&lt;service&gt;.&lt;namespace&gt;:&lt;port&gt;/api/v1/'
  ...
}
</code></pre>
<p>Currently the URL is hardcode in <code>environemnt.ts</code> and the image is built using Dockerfile.</p>
<p>Say, If I want to use the image and deploy as Kubernetes deployment, is there a way to pass this <code>baseURL</code> in the manifest during runtime or dynamically? Note, trying to deploy httpd server not Nginx.</p>

Tim
<p>Dont use environment.ts in the first place as it works fine when you build your app, but not when you actually try to use the same codebase on different environments (as you have figured out yourself).</p>
<p>What I did in a past was to use some sort of tokens in the <code>environment.ts</code> eg</p>
<pre><code>export const environment = {
  production: true,
  baseURL: 'BASE_URL'
  ...
}
</code></pre>
<p>and then during the deployment I was literally replacing <code>BASE_URL</code> in the <code>main.js</code> file with <code>sed</code>. Its not ideal, even kind of bad, but it worked just fine as you expected.</p>
<p>Another way would be to externalize your config to a separate file that will be placed next to the deployment, eg <code>env.js</code>. Such file can be served as any other parts of your application, therfore on the bootstrap you will be able to fetch it and provide via &quot;configuration service&quot; of your design.</p>
