Skip to content

Commit

Permalink
Add flag to modify db (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass authored Jan 30, 2025
1 parent 1d3a074 commit 626299d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/helium-vote-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,11 @@ function deepCamelCaseKeys(obj: any): any {
}
}

const MODIFY_DB = (process.env.MODIFY_DB || "true") === "true";
const start = async () => {
try {
await ProxyRegistrar.sync({ alter: true });
await Proxy.sync({ alter: true });
await ProxyRegistrar.sync({ alter: MODIFY_DB });
await Proxy.sync({ alter: MODIFY_DB });
const port = process.env.PORT ? Number(process.env.PORT) : 8081;
await server.listen({
port,
Expand All @@ -431,7 +432,9 @@ const start = async () => {
const sqlQuery = fs.readFileSync(sqlFilePath, "utf8");

// Execute SQL query
await sequelize.query(sqlQuery);
if (MODIFY_DB) {
await sequelize.query(sqlQuery);
}
await cloneRepo();
await readProxiesAndUpsert();
console.log("Created models");
Expand Down

0 comments on commit 626299d

Please sign in to comment.