Atlassian connect express with external database

I am trying to develop a plugin for Jira cloud using atlassian connect express framework. My requirement is to use an external database with the plugin (Preferebly with sequelize). Is there any docs or tutorials i can use to get an idea? all the samples and tutorials available does not mention about using any databases.

Hi @AkalankaJayalath,

In your project, do you see a config.json file with a store section in it? This is how you configure it to work with a different database. Here’s a snippet I see in one of my projects:

        // To configure PostgreSQL, the following can be used:
        //
        //   "store": {
        //     "adapter": "sequelize",
        //     "dialect": "postgres",
        //     "url": "postgres://localhost/my_app_database"
        //   },
        //
        // An appropriate DB driver for Sequelize is required for storage other than memory.
        // For PostgreSQL, run the following command:
        //
        //   npm install --save pg
        "store": {
            "adapter": "sequelize",
            "dialect": "sqlite3",
            "logging": false,
            "type": "memory"
        }

Regards,
Dugald

Hi @dmorrow
Thanks for pointing me in the direction. So this store object will be available for me in js files?

@dmorrow can you please guide me how to use this database object within ACE app

Hi @AkalankaJayalath,

I am not sure if this actually documented somewhere, but you can just use:

addon.settings.set(key, object, clientKey)
addon.settings.get(key, clientKey)

With key being a unique for your setting, object being some JS object and clientKey the clientKey of the tenant (ie the Jira instance your app is installed on).

This works well for small amounts of data, like key:value type things. If you want anything more complex, you can just use the credentials stored in config.json and open additional connections to your db as you would in any Node application.

Hope that helps,
Oliver