Hi all,
Until now, I was developping a nodejs JIRA add-on using a locally started JIRA, then promoting the validated code to a heroku production environment. I've been reading the new way to developp locally (https://developer.atlassian.com/static/connect/docs/latest/developing/developing-locally.html), and I am switching to this mode.
But I have a question: a baseURL variable must be set in the add-on descriptior, but how to set it once for development stage and for production stage once, with a different value for development and environment stage? I'd like to set this variable for the two cases, without having to change after when I comit on heroku.
Currently I have:
And here are them:
Atlassian-connect.json
{
"key": "deeper",
"name": "Deeper",
"description": "AC add-on.",
"vendor": {
"name": "Tartech Ltd.",
"url": "http://www.tartech.net"
},
"baseUrl": "{{localBaseUrl}}",
"links": {
"self": "{{localBaseUrl}}/atlassian-connect.json",
"homepage": "{{localBaseUrl}}/atlassian-connect.json"
},
"authentication": {
"type": "jwt"
},
"lifecycle": {
// atlassian-connect-express expects this route to be configured to manage the installation handshake
"installed": "/installed"
},
"scopes": [
"READ"
],
"modules": {
"generalPages": [
{
"key": "deeper",
"location": "system.top.navigation.bar",
"name": {
"value": "Deeper"
},
"url": "/deeper",
"conditions": [{
"condition": "user_is_logged_in"
}]
}
]
}
}
config.json
{
"development": {
"port": 3000,
"errorTemplate": true,
"store": {
"adapter": "jugglingdb",
"type": "sqlite3",
"database": "store.db"
},
"hosts": [
"http://admin:admin@localhost:1990/confluence",
"http://admin:admin@localhost:2990/jira"
]
},
"production": {
"port": "$PORT",
"errorTemplate": true,
"localBaseUrl": "https://jira-ft.herokuapp.com",
"store": {
"type": "postgres",
"url": "$DATABASE_URL"
},
"whitelist": [
"*.jira-dev.com",
"*.atlassian.net",
"*.atlassian.com",
"*.jira.com"
]
}
}
Thanks a lot,
Fred
Community moderators have prevented the ability to post new answers.
Hey Frédéric,
I'm about to code this exact thing in a boilerplate add-on and I'll use to spin up development quickly. I've looked at how ACE currently handles it and there's a lot to learn there by reading the code. Here's the plan of attack I'm planning to do based on what ACE is doing:
What they do is read in the JSON files (using the fs module) for config.json and the descriptor, they're JSON parsed and then searched and replace the {{localBaseUrl}} with the config json value.
Hopefully that helps.
Ralph
Hey Ralp,
Seems to work, but when adding localBaseURL and value to my config.json file in the development section, and trying to upload my add-on to JIRA dev cloud instance, I get the message:
The add-on host returned HTTP response code 404 when we tried to contact it during installation. Please try again later or contact the add-on vendor.
But I see on ngrok log that
GET /atlassian-connect.json 200 OK
GET / 302 Found
Do you have an idea why I get a 404 code in JIRA when ngrok does not show any 404?
Thanks,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Frédéric Tardieu if you haven't managed to fix this yet, it looks like JIRA is successfully retrieving your descriptor, but failing to post to your /installed
callback. Make sure you've updated the value of the localBaseUrl variable in your config.json to match your current ngrok url. You might have to kill/restart the node app. You can browse to <your-ngrok-url>/atlassian-connect.json to make sure the url in your descriptor matches the url it's being served from.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I see you solved this over on the google group: https://groups.google.com/forum/#!topic/atlassian-connect-dev/cPMFvK3gN0k.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jake,
Yes right! Thank you anyway for your support!
Cheers,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.