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.

  • bundling source code in docker containers
  • AWS ECS leader commands (django migrate)
  • Kubernetes - Unknown admission plugin: DefaultStorageClass
  • Docker command/option to display or list the build context
  • How to create user in mongodb with docker-compose
  • Unable to install vim or nano inside docker container
  • 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 setup environments for MERN apps
  • Unable to start Mysql in a Dockerfile when executing CMD script
  • docker container in AWS VPC, good idea or not? [closed]
  • Can I clone a paused Docker container?
  • How can I use a variable inside a Dockerfile CMD?
  • Configure Postgres application users with Terraform for RDS
  • 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.