Skip to content

Commit

Permalink
Fix for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermau committed Dec 11, 2024
1 parent bcd4484 commit e4cdbd5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
11 changes: 5 additions & 6 deletions api/src/core/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 ------");
}
}

Expand Down
4 changes: 2 additions & 2 deletions api/src/core/usecases/importFromSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 1 addition & 3 deletions api/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(",")
};
};

Expand Down
5 changes: 1 addition & 4 deletions deployments/docker-compose-example/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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=[email protected]

Expand Down

0 comments on commit e4cdbd5

Please sign in to comment.