@cocalc/backend
Version:
CoCalc backend functionality: functionality used by either the hub, the next.js server or the project.
33 lines (32 loc) • 1.84 kB
JavaScript
;
/*
We prefix the cookie with the base path so that it's possible to
have multiple distinct cocalc servers running on the same domain
without them colliding when doing development. However, this doesn't
help with multiple cocalc's on the same server with the same base
path serving on distinct ports. In that case, you can explicitly
set the remember me cookie name to whatever you want by
setting the following environment variable:
- COCALC_REMEMBER_ME_COOKIE_NAME -- env variable for arbitrary remember_me cookie name
- COCALC_API_COOKIE_NAME -- similar for the api cookie name.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.API_COOKIE_NAME = exports.REMEMBER_ME_COOKIE_NAME = void 0;
const base_path_1 = __importDefault(require("@cocalc/backend/base-path"));
const logger_1 = __importDefault(require("@cocalc/backend/logger"));
const log = (0, logger_1.default)("cookie-names");
// Name of user provided remember_me cookie -- this is http-only and gets set
// when the user is signed in.
exports.REMEMBER_ME_COOKIE_NAME = process.env.COCALC_REMEMBER_ME_COOKIE_NAME ??
`${base_path_1.default.length <= 1 ? "" : encodeURIComponent(base_path_1.default)}remember_me`;
log.debug("REMEMBER_ME_COOKIE_NAME", exports.REMEMBER_ME_COOKIE_NAME);
// Name of user provided api key cookie, with appropriate base path.
// This is set by the user when using the api from node.js, especially
// via a websocket.
exports.API_COOKIE_NAME = process.env.COCALC_API_COOKIE_NAME ??
`${base_path_1.default.length <= 1 ? "" : encodeURIComponent(base_path_1.default)}api_key`;
log.debug("API_COOKIE_NAME", exports.API_COOKIE_NAME);
//# sourceMappingURL=cookie-names.js.map