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.

  • Using compose in (fabric8io) docker-maven-plugin deactivates image build
  • Connecting to percona docker from a java docker container
  • database docker container design
  • automation script for postgresql
  • Spring Cloud Config Server cannot connect to git over ssh in Docker
  • Grails 3.1.4 and Docker - grails commands return “No profile found for name web”
  • 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 and “The OpenSSL library reported an error” when deployed
  • Start docker-machine On Boot
  • Docker-compose restart only updated images
  • StartSSL SSL certificate showing up as net::ERR_CERT_AUTHORITY_INVALID in browser
  • Kubernetes & insecure docker registries
  • How to gain bash access to a docker container after its ran
  • 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.