# How to change to a production environment in ACE cloud add-on using Node.js

**URL:** <https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947>\
**Category:** Jira Cloud\
**Tags:** nodejs, ac-express, jira-cloud, environments\
**Created:** [June 16, 2021, 6:56am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947 "2021-06-16T06:56:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivana1](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Ivana1](https://community.developer.atlassian.com/u/Ivana1)\
**Post date:** [June 16, 2021, 6:56am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/1 "2021-06-16T06:56:24Z")

</div>

Hello everyone. I developed a cloud addon with ACE and Node.js in development environment using ngrok which worked perfectly on a local machine. Now I want to test the addon which is set on a https server. Should I change the environment to production or can I use the development environment but without the ngrok tunneling, and how it would be? Thank you

---

<div class="post-metadata">

**Author:** ![dmorrow](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/dmorrow/32/35895_2.png) [@dmorrow](https://community.developer.atlassian.com/u/dmorrow)\
**Post date:** [June 16, 2021, 7:38am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/2 "2021-06-16T07:38:33Z")

</div>

Hi @Ivana1 ,

To test in your production environment, you probably wouldn’t want to be using ngrok and auto registering. I’d recommend using the `production` settings of your `config.json`. On the assumption you’ve configured the `production` settings to use a real data store rather than memory, then it shouldn’t be self registering unless you’ve overridden the `force-reg` option.

Regards,  
Dugald

---

<div class="post-metadata">

**Author:** ![Ivana1](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Ivana1](https://community.developer.atlassian.com/u/Ivana1)\
**Post date:** [June 16, 2021, 7:45am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/3 "2021-06-16T07:45:11Z")

</div>

Than you @dmorrow for the response,  
but can I install the addon which is served on my own https server, and still using development environement from the config.json file, with disabled ngrok tunneling and auto-registration somehow?

---

<div class="post-metadata">

**Author:** ![dmorrow](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/dmorrow/32/35895_2.png) [@dmorrow](https://community.developer.atlassian.com/u/dmorrow)\
**Post date:** [June 16, 2021, 7:48am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/4 "2021-06-16T07:48:48Z")

</div>

Hi @Ivana1 ,

I think this is possible. Have you seen the [atlassian-connect-express](https://bitbucket.org/atlassian/atlassian-connect-express/src/master/) documentation?

Regards,  
Dugald

---

<div class="post-metadata">

**Author:** ![osiebenmarck](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/osiebenmarck/32/40280_2.png) [@osiebenmarck](https://community.developer.atlassian.com/u/osiebenmarck)\
**Post date:** [June 18, 2021, 6:33am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/5 "2021-06-18T06:33:54Z")

</div>

Hi @Ivana1,

Yes, you can certainly do that. As @dmorrow rightly points out, you can use `config.json` to define various settings. And while the default uses environments like `development` and `production`, you can also define additional environments to suit your needs, like `dev-test` or `dev-without-auto-reg`.

As an additional recommendation, you should use something like [dotenv](https://www.npmjs.com/package/dotenv) to control which environment the application runs in.

Hope that helps,  
Oliver

---

<div class="post-metadata">

**Author:** ![Ivana1](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Ivana1](https://community.developer.atlassian.com/u/Ivana1)\
**Post date:** [June 30, 2021, 7:10am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/6 "2021-06-30T07:10:34Z")

</div>

> [@osiebenmarck](#):
>
> `dev-without-auto-reg` .

Thank you @osiebenmarck ,  
How can I define an environment like dev-without-auto-reg?

---

<div class="post-metadata">

**Author:** ![osiebenmarck](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/osiebenmarck/32/40280_2.png) [@osiebenmarck](https://community.developer.atlassian.com/u/osiebenmarck)\
**Post date:** [June 30, 2021, 9:00am UTC](https://community.developer.atlassian.com/t/how-to-change-to-a-production-environment-in-ace-cloud-add-on-using-node-js/48947/7 "2021-06-30T09:00:18Z")

</div>

Hi @Ivana1 ,

it’s really easy, just add it to `config.json` like this:

```auto
{
    "development": {
        "localBaseUrl": "$BASEURL",
        "port": 3000,
        "errorTemplate": true,
        "store": {
            "adapter": "sequelize",
            "dialect": "postgres",
            "url": "$DATABASE_URL"
        }
    },
    "dev-without-auto-reg": {
        "port": 3000,
        "errorTemplate": true,
        "localBaseUrl": "$BASEURL",
        "store": {
            "type": "postgres",
            "url": "$DATABASE_URL"
        }
    },
  ... // More environments
}

```

Now, the more interesting part is using dotenv, which allows you define a environment variables pretty easily. Here’s how that might look like:

```auto
AC_OPTS=no-reg
NODE_ENV=dev-without-auto-reg
BASEURL=https://my-cool-app.dev-test.com
DATABASE_URL=postgres://user:pass@somewhere

```

Personally, I then start my app with `node -r esm -r dotenv/config src/app.js` which tells dotenv to load the environment variables from the `.env` file. If you want to use a different environment, simply edit the `.env` file.

Hope that helps,  
Oliver
