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.

  • How to build a docker container for a java app
  • Why does chown increase size of docker image?
  • How can I know why Docker container stopped?
  • How to change ip address to domain name in ionic application
  • Connecting docker locally with vagrant provisioned docker
  • Cassandra inside Docker
  • 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

  • How to let a non-root process in a Linux docker container bind to a <1024 port?
  • E: Unable to locate package redis-server
  • Why docker container exits immediately
  • Is it possible to link existing containers with docker?
  • docker with btrfs ubuntu
  • NET I/O stats value missing inside GKE docker container
  • 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.