@codegouvfr/sill
Advanced tools
Comparing version 1.18.10 to 1.18.11
88
main.js
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var _a, _b; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const symToStr_1 = require("tsafe/symToStr"); | ||
const assert_1 = require("tsafe/assert"); | ||
const JSONC = __importStar(require("comment-json")); | ||
const zod_1 = require("zod"); | ||
const GetWikidataSoftware_1 = require("./core/ports/GetWikidataSoftware"); | ||
const rpc_1 = require("./rpc"); | ||
const is_1 = require("tsafe/is"); | ||
const zParsedCONFIGURATION = zod_1.z.object({ | ||
"keycloakParams": zod_1.z | ||
.object({ | ||
"url": zod_1.z.string().nonempty(), | ||
"realm": zod_1.z.string().nonempty(), | ||
"clientId": zod_1.z.string().nonempty(), | ||
"adminPassword": zod_1.z.string().nonempty(), | ||
"organizationUserProfileAttributeName": zod_1.z.string().nonempty() | ||
}) | ||
.optional(), | ||
"termsOfServiceUrl": GetWikidataSoftware_1.zLocalizedString, | ||
"readmeUrl": GetWikidataSoftware_1.zLocalizedString, | ||
"jwtClaimByUserKey": zod_1.z.object({ | ||
"id": zod_1.z.string().nonempty(), | ||
"email": zod_1.z.string().nonempty(), | ||
"organization": zod_1.z.string().nonempty() | ||
}), | ||
"dataRepoSshUrl": zod_1.z.string().nonempty(), | ||
// Like id_ed25537 | ||
"sshPrivateKeyForGitName": zod_1.z.string().nonempty(), | ||
// Like -----BEGIN OPENSSH PRIVATE KEY-----\nxxx ... xxx\n-----END OPENSSH PRIVATE KEY-----\n | ||
// You can a fake key in .env.local.sh for running yarn dev | ||
"sshPrivateKeyForGit": zod_1.z.string().nonempty(), | ||
"githubWebhookSecret": zod_1.z.string().nonempty().optional(), | ||
// Only for increasing the rate limit on GitHub API | ||
// we use the GitHub API for pre filling the version when adding a software | ||
"githubPersonalAccessTokenForApiRateLimit": zod_1.z.string().nonempty(), | ||
//Port we listen to, default 8080 | ||
"port": zod_1.z.number().optional(), | ||
"isDevEnvironnement": zod_1.z.boolean().optional(), | ||
// Completely disable this instance and redirect to another url | ||
"redirectUrl": zod_1.z.string().optional() | ||
}); | ||
const { parsedCONFIGURATION } = (() => { | ||
const { CONFIGURATION } = process.env; | ||
if (CONFIGURATION === undefined) { | ||
throw new Error(`We need a ${(0, symToStr_1.symToStr)({ | ||
CONFIGURATION | ||
})} environnement variable`); | ||
} | ||
let parsedCONFIGURATION; | ||
try { | ||
parsedCONFIGURATION = JSONC.parse(CONFIGURATION); | ||
} | ||
catch (error) { | ||
throw new Error(`The CONFIGURATION environnement variable is not a valid JSONC string (JSONC = JSON + Comment support)\n${CONFIGURATION}`, { cause: error }); | ||
} | ||
zParsedCONFIGURATION.parse(parsedCONFIGURATION); | ||
(0, assert_1.assert)((0, is_1.is)(parsedCONFIGURATION)); | ||
return { parsedCONFIGURATION }; | ||
})(); | ||
(0, rpc_1.startRpcService)({ | ||
...parsedCONFIGURATION, | ||
"port": (_a = parsedCONFIGURATION.port) !== null && _a !== void 0 ? _a : 8080, | ||
"isDevEnvironnement": (_b = parsedCONFIGURATION.isDevEnvironnement) !== null && _b !== void 0 ? _b : false | ||
}); | ||
const env_1 = require("./env"); | ||
(0, rpc_1.startRpcService)(env_1.env); | ||
//# sourceMappingURL=main.js.map |
{ | ||
"name": "@codegouvfr/sill", | ||
"version": "1.18.10", | ||
"version": "1.18.11", | ||
"description": "The backend of code.gouv.fr/sill", | ||
@@ -54,2 +54,3 @@ "repository": { | ||
"src/core/usecases/suggestionAndAutoFill/thunks.ts", | ||
"src/env.ts", | ||
"src/global.d.ts", | ||
@@ -178,2 +179,5 @@ "src/lib/ApiTypes.ts", | ||
"core/usecases/suggestionAndAutoFill/thunks.js.map", | ||
"env.d.ts", | ||
"env.js", | ||
"env.js.map", | ||
"lib/ApiTypes.d.ts", | ||
@@ -299,3 +303,2 @@ "lib/ApiTypes.js", | ||
"deepmerge": "^4.2.2", | ||
"dotenv-cli": "^7.3.0", | ||
"evt": "^2.4.18", | ||
@@ -302,0 +305,0 @@ "express": "^4.17.2", |
@@ -1,76 +0,4 @@ | ||
import { symToStr } from "tsafe/symToStr"; | ||
import { assert } from "tsafe/assert"; | ||
import * as JSONC from "comment-json"; | ||
import { z } from "zod"; | ||
import { zLocalizedString } from "./core/ports/GetWikidataSoftware"; | ||
import { startRpcService } from "./rpc"; | ||
import { is } from "tsafe/is"; | ||
import { env } from "./env"; | ||
const zParsedCONFIGURATION = z.object({ | ||
"keycloakParams": z | ||
.object({ | ||
"url": z.string().nonempty(), //Example: https://auth.code.gouv.fr/auth (with the /auth at the end) | ||
"realm": z.string().nonempty(), | ||
"clientId": z.string().nonempty(), | ||
"adminPassword": z.string().nonempty(), | ||
"organizationUserProfileAttributeName": z.string().nonempty() | ||
}) | ||
.optional(), | ||
"termsOfServiceUrl": zLocalizedString, | ||
"readmeUrl": zLocalizedString, | ||
"jwtClaimByUserKey": z.object({ | ||
"id": z.string().nonempty(), | ||
"email": z.string().nonempty(), | ||
"organization": z.string().nonempty() | ||
}), | ||
"dataRepoSshUrl": z.string().nonempty(), | ||
// Like id_ed25537 | ||
"sshPrivateKeyForGitName": z.string().nonempty(), | ||
// Like -----BEGIN OPENSSH PRIVATE KEY-----\nxxx ... xxx\n-----END OPENSSH PRIVATE KEY-----\n | ||
// You can a fake key in .env.local.sh for running yarn dev | ||
"sshPrivateKeyForGit": z.string().nonempty(), | ||
"githubWebhookSecret": z.string().nonempty().optional(), | ||
// Only for increasing the rate limit on GitHub API | ||
// we use the GitHub API for pre filling the version when adding a software | ||
"githubPersonalAccessTokenForApiRateLimit": z.string().nonempty(), | ||
//Port we listen to, default 8080 | ||
"port": z.number().optional(), | ||
"isDevEnvironnement": z.boolean().optional(), | ||
// Completely disable this instance and redirect to another url | ||
"redirectUrl": z.string().optional() | ||
}); | ||
const { parsedCONFIGURATION } = (() => { | ||
const { CONFIGURATION } = process.env; | ||
if (CONFIGURATION === undefined) { | ||
throw new Error( | ||
`We need a ${symToStr({ | ||
CONFIGURATION | ||
})} environnement variable` | ||
); | ||
} | ||
let parsedCONFIGURATION: unknown; | ||
try { | ||
parsedCONFIGURATION = JSONC.parse(CONFIGURATION) as any; | ||
} catch (error) { | ||
throw new Error( | ||
`The CONFIGURATION environnement variable is not a valid JSONC string (JSONC = JSON + Comment support)\n${CONFIGURATION}`, | ||
{ cause: error } | ||
); | ||
} | ||
zParsedCONFIGURATION.parse(parsedCONFIGURATION); | ||
assert(is<ReturnType<(typeof zParsedCONFIGURATION)["parse"]>>(parsedCONFIGURATION)); | ||
return { parsedCONFIGURATION }; | ||
})(); | ||
startRpcService({ | ||
...parsedCONFIGURATION, | ||
"port": parsedCONFIGURATION.port ?? 8080, | ||
"isDevEnvironnement": parsedCONFIGURATION.isDevEnvironnement ?? false | ||
}); | ||
startRpcService(env); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
637473
38
255
11783