Skip to content

Commit

Permalink
misc: verify appServer
Browse files Browse the repository at this point in the history
  • Loading branch information
embbnux committed Dec 10, 2024
1 parent c08e1a2 commit f0d877c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,22 @@ const clientSecretFromParams = pathParams.clientSecret || pathParams.appSecret;
const authProxy = pathParams.authProxy;
const enableDiscovery = !!pathParams.discovery;
const discoverAppServer = pathParams.discoverAppServer;

function getAppServer() {
if (
pathParams.appServer &&
pathParams.appServer.indexOf('https://') === 0 &&
pathParams.appServer.indexOf('?') === -1 &&
pathParams.appServer.indexOf('javascript') === -1
) {
return pathParams.appServer;
}
return defaultApiConfig.server;
}
const apiConfig = {
clientId: clientIdFromParams || defaultApiConfig.appKey,
clientSecret: (clientIdFromParams ? clientSecretFromParams : defaultApiConfig.appSecret),
server: pathParams.appServer || defaultApiConfig.server,
server: getAppServer(),
};
if (enableDiscovery) {
apiConfig.enableDiscovery = enableDiscovery;
Expand Down

0 comments on commit f0d877c

Please sign in to comment.