CoolFace
Apppublic

sanket3280/code-execution

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
urlHelper.js33 linesDownload Raw Back to utils
1/**2 * Utility function to get the appropriate base URL based on environment3 * @returns {string} The base URL for the current environment4 */5function getBaseUrl() {6  if (process.env.NODE_ENV === 'production') {7    return 'https://codebattless.netlify.app';8  } else if (process.env.CLIENT_URL) {9    return process.env.CLIENT_URL;10  } else {11    return 'http://localhost:3000';12  }13}14 15/**16 * Get the auth callback URL based on environment17 * @returns {string} The auth callback URL for the current environment18 */19function getAuthCallbackUrl() {20  if (process.env.NODE_ENV === 'production') {21    return process.env.AUTH_CALLBACK_URL || 'https://codebattless.netlify.app';22  } else if (process.env.AUTH_CALLBACK_URL) {23    return process.env.AUTH_CALLBACK_URL;24  } else {25    return 'http://localhost:3000';26  }27}28 29module.exports = {30  getBaseUrl,31  getAuthCallbackUrl32};33