diff --git a/api/src/core/bootstrap.ts b/api/src/core/bootstrap.ts index 9578e17c..7cf890ee 100644 --- a/api/src/core/bootstrap.ts +++ b/api/src/core/bootstrap.ts @@ -120,9 +120,9 @@ export async function bootstrapCore( } if (initializeSoftwareFromSource) { + if (!botAgentEmail) throw new Error("No bot agent email provided"); if (externalSoftwareDataOrigin === "HAL") { - console.log(" ------ Feeding database with HAL software started ------"); - if (!botAgentEmail) throw new Error("No bot agent email provided"); + console.info(" ------ Feeding database with HAL software started ------"); const importHAL = importFromHALSource(dbApi); try { await importHAL(botAgentEmail); @@ -131,18 +131,17 @@ export async function bootstrapCore( console.error(err); } - console.log(" ------ Feeding database with HAL software finished ------"); + console.info(" ------ Feeding database with HAL software finished ------"); } if (externalSoftwareDataOrigin === "wikidata") { - console.log(" ------ Feeding database with Wikidata software started ------"); - if (!botAgentEmail) throw new Error("No bot agent email provided"); + console.info(" ------ Feeding database with Wikidata software started ------"); const importWikidata = importFromWikidataSource(dbApi); try { await importWikidata(botAgentEmail, listToImport ?? []); } catch (err) { console.error(err); } - console.log(" ------ Feeding database with Wikidata software finished ------"); + console.info(" ------ Feeding database with Wikidata software finished ------"); } } diff --git a/api/src/core/usecases/importFromSource.ts b/api/src/core/usecases/importFromSource.ts index d3fc6ecb..f1bd438e 100644 --- a/api/src/core/usecases/importFromSource.ts +++ b/api/src/core/usecases/importFromSource.ts @@ -14,7 +14,7 @@ export const importFromHALSource: (dbApi: DbApiV2) => (agentEmail: string) => Pr email: agentEmail, "isPublic": false, organization: "", - about: "This is an bot user created to import data." + about: "This is a bot user created to import data." }); const softwares = await halAPIGateway.software.getAll(); @@ -48,7 +48,7 @@ export const importFromWikidataSource: ( email: agentEmail, "isPublic": false, organization: "", - about: "This is an bot user created to import data." + about: "This is a bot user created to import data." }); const dbSoftwares = await dbApi.software.getAll(); diff --git a/api/src/env.ts b/api/src/env.ts index 8f2f21d6..5e2ac1cd 100644 --- a/api/src/env.ts +++ b/api/src/env.ts @@ -71,9 +71,7 @@ const getJsonConfiguration = () => { "databaseUrl": process.env.DATABASE_URL, "initializeSoftwareFromSource": process.env.INIT_SOFT_FROM_SOURCE?.toLowerCase() === "true", "botAgentEmail": process.env?.BOT_AGENT_EMAIL, - "listToImport": process.env?.SILL_IMPORT_WIKIDATA - ? JSON.parse(process.env?.SILL_IMPORT_WIKIDATA)?.ids - : undefined + "listToImport": process.env?.SILL_IMPORT_WIKIDATA?.split(",") }; }; diff --git a/deployments/docker-compose-example/.env.sample b/deployments/docker-compose-example/.env.sample index b97c3627..cb9050c0 100644 --- a/deployments/docker-compose-example/.env.sample +++ b/deployments/docker-compose-example/.env.sample @@ -12,10 +12,7 @@ SILL_GITHUB_TOKEN=xxxxx SILL_API_PORT=3084 SILL_IS_DEV_ENVIRONNEMENT=true SILL_EXTERNAL_SOFTWARE_DATA_ORIGIN=wikidata -SILL_IMPORT_WIKIDATA=| - { - ids: ['Q10135'] - } +SILL_IMPORT_WIKIDATA=Q10135,Q25874683 INIT_SOFT_FROM_SOURCE=false BOT_AGENT_EMAIL=contact@sill.codegouv.fr