How to programmatically know if I am building with -prod flag (ng build -prod)

I am using docker so, in production mode I am using linked containers with URLs like “http://api:3000/”
instead of “http://localhost:3000/” while in dev mode.

I would like to be able to use “http://api:3000/” if “ng build -prod” and stay with “localhost” while developing.

  • Docker DNS Not Seeing External Servers
  • Docker installation just downloads index.html file
  • how to redirect no-www to www under jwilder/nginx-proxy?
  • Ultraedit docker syntax hightlighting file
  • /public/img/ folder not acceping new assets in Go-compiled web app
  • docker and composer install
  • How can I do my if( “-prod” ) ?

    Thanks for reading me, I hope my question is clear.

    EDIT: Everything was explain in a commentary in environment.ts
    enter image description here

  • Docker - Install PDO Driver for PHP + Nginx
  • Docker + Wordpress + Traefik
  • How is Vagrant an advantage over boot2docker? [closed]
  • Docker Automated build downloading private jars from a Maven Sonatype Nexus repository
  • In docker, difference with commit and dockerfile
  • Docker maven and jenkins, mvn install failed requesting junit:junit:jar:3.x
  • One Solution collect form web for “How to programmatically know if I am building with -prod flag (ng build -prod)”

    You have environments/environment.ts, and there is a json

    export const environment = {
        production = false
    };
    

    And you can access it within your application with importing it and then using it with if(environment.production)

    or use the built in angular module like in
    How to check if Angular 2 app is running in production or dev

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.