# Having different configuration options for testing and production environments

**URL:** <https://forum.ionicframework.com/t/having-different-configuration-options-for-testing-and-production-environments/56872>\
**Category:** ionic-v3\
**Created:** [July 7, 2016, 2:23pm UTC](https://forum.ionicframework.com/t/having-different-configuration-options-for-testing-and-production-environments/56872 "2016-07-07T14:23:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sameera207](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sameera207/32/101489_2.png) [@sameera207](https://forum.ionicframework.com/u/sameera207)\
**Post date:** [July 7, 2016, 2:23pm UTC](https://forum.ionicframework.com/t/having-different-configuration-options-for-testing-and-production-environments/56872/1 "2016-07-07T14:23:49Z")

</div>

Hey All,

I would like to know, that is the standard ionic way of having different configurations for different environments.

For an example,

- When I test my app, all the `http` requests in my Providers are pointing to my staging / local api end point.

- When I go for production, those should be pointed to the production url endpoint.

I’m coming from a ruby/rails background and in rails we have basic 3 different environments (development / testing / production) to have different config options.

Just wanted to get an advise from more experience ppl than me 🙂, thanks in advance.

cheers

Sam

---

<div class="post-metadata">

**Author:** ![itlr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/itlr/32/97646_2.png) [@itlr](https://forum.ionicframework.com/u/itlr)\
**Post date:** [July 7, 2016, 4:07pm UTC](https://forum.ionicframework.com/t/having-different-configuration-options-for-testing-and-production-environments/56872/2 "2016-07-07T16:07:42Z")

</div>

```auto
ionicBootstrap(MyApp, [], { prodMode: window.hasOwnProperty('cordova')});

```

With a bit of encapsulation, the same approach can be used in many places.

---

<div class="post-metadata">

**Author:** ![matheo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/matheo/32/91507_2.png) [@matheo](https://forum.ionicframework.com/u/matheo)\
**Post date:** [July 7, 2016, 4:10pm UTC](https://forum.ionicframework.com/t/having-different-configuration-options-for-testing-and-production-environments/56872/3 "2016-07-07T16:10:53Z")

</div>

@itlr and later how do I detect the prodMode enabled inside my services?

---

<div class="post-metadata">

**Author:** ![itlr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/itlr/32/97646_2.png) [@itlr](https://forum.ionicframework.com/u/itlr)\
**Post date:** [July 7, 2016, 4:22pm UTC](https://forum.ionicframework.com/t/having-different-configuration-options-for-testing-and-production-environments/56872/4 "2016-07-07T16:22:14Z")

</div>

@matheo you can put the state in a CONFIG obejct

```auto
const prod = window.hasOwnProperty('cordova');
export var CONFIG = {
  prod: prod
}

```

and inject or simply import the CONFIG object into where-ever needed

**[Following approach is invalid]**

or if you don’t want to use a separate config object or anything like that

I think injecting Platform should give you the passed in `prodMode` state.

```auto
import {Platform} from ... // see app.ts
class MyService {
  constructor (platform: Platform)
}

```
