|
@@ -22,7 +22,6 @@ const logger = loggerFactory('growi:routes:apiv3:slack-integration-settings');
|
|
|
|
|
|
|
|
const router = express.Router();
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
-const OFFICIAL_SLACKBOT_PROXY_URI = 'https://slackbot-proxy.growi.org';
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
@@ -110,17 +109,12 @@ module.exports = (crowi) => {
|
|
|
'slackbot:proxyUri': null,
|
|
'slackbot:proxyUri': null,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- // set url if officialBot is specified
|
|
|
|
|
- if (initializedType === SlackbotType.OFFICIAL) {
|
|
|
|
|
- params['slackbot:proxyUri'] = OFFICIAL_SLACKBOT_PROXY_URI;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return updateSlackBotSettings(params);
|
|
return updateSlackBotSettings(params);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function getConnectionStatusesFromProxy(tokens) {
|
|
async function getConnectionStatusesFromProxy(tokens) {
|
|
|
const csv = tokens.join(',');
|
|
const csv = tokens.join(',');
|
|
|
- const proxyUri = crowi.configManager.getConfig('crowi', 'slackbot:proxyUri');
|
|
|
|
|
|
|
+ const proxyUri = crowi.slackIntegrationService.proxyUriForCurrentType;
|
|
|
|
|
|
|
|
const result = await axios.get(urljoin(proxyUri, '/g2s/connection-status'), {
|
|
const result = await axios.get(urljoin(proxyUri, '/g2s/connection-status'), {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -133,7 +127,7 @@ module.exports = (crowi) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function requestToProxyServer(token, method, endpoint, body) {
|
|
async function requestToProxyServer(token, method, endpoint, body) {
|
|
|
- const proxyUri = crowi.configManager.getConfig('crowi', 'slackbot:proxyUri');
|
|
|
|
|
|
|
+ const proxyUri = crowi.slackIntegrationService.proxyUriForCurrentType;
|
|
|
if (proxyUri == null) {
|
|
if (proxyUri == null) {
|
|
|
throw new Error('Proxy URL is not registered');
|
|
throw new Error('Proxy URL is not registered');
|
|
|
}
|
|
}
|
|
@@ -557,7 +551,7 @@ module.exports = (crowi) => {
|
|
|
{ new: true },
|
|
{ new: true },
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- const proxyUri = crowi.configManager.getConfig('crowi', 'slackbot:proxyUri');
|
|
|
|
|
|
|
+ const proxyUri = crowi.slackIntegrationService.proxyUriForCurrentType;
|
|
|
if (proxyUri != null) {
|
|
if (proxyUri != null) {
|
|
|
await requestToProxyServer(
|
|
await requestToProxyServer(
|
|
|
slackAppIntegration.tokenGtoP,
|
|
slackAppIntegration.tokenGtoP,
|
|
@@ -600,7 +594,7 @@ module.exports = (crowi) => {
|
|
|
return res.apiv3Err(new ErrorV3(msg, 'not-proxy-type'), 400);
|
|
return res.apiv3Err(new ErrorV3(msg, 'not-proxy-type'), 400);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const proxyUri = crowi.configManager.getConfig('crowi', 'slackbot:proxyUri');
|
|
|
|
|
|
|
+ const proxyUri = crowi.slackIntegrationService.proxyUriForCurrentType;
|
|
|
if (proxyUri == null) {
|
|
if (proxyUri == null) {
|
|
|
return res.apiv3Err(new ErrorV3('Proxy URL is null.', 'not-proxy-Uri'), 400);
|
|
return res.apiv3Err(new ErrorV3('Proxy URL is null.', 'not-proxy-Uri'), 400);
|
|
|
}
|
|
}
|