parent
da9a359251
commit
67ba489fe2
@ -9,7 +9,8 @@ export const config = {
|
|||||||
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret",
|
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret",
|
||||||
phone_validation_countrycode: getPhoneCodeLocale(),
|
phone_validation_countrycode: getPhoneCodeLocale(),
|
||||||
postalcode_validation_countrycode: getPostalCodeLocale(),
|
postalcode_validation_countrycode: getPostalCodeLocale(),
|
||||||
version: process.env.VERSION || require('../package.json').version
|
version: process.env.VERSION || require('../package.json').version,
|
||||||
|
seedTestData: process.env.SEED_TEST || false
|
||||||
}
|
}
|
||||||
let errors = 0
|
let errors = 0
|
||||||
if (typeof config.internal_port !== "number") {
|
if (typeof config.internal_port !== "number") {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { createConnection } from "typeorm";
|
import { createConnection } from "typeorm";
|
||||||
import { runSeeder } from 'typeorm-seeding';
|
import { runSeeder } from 'typeorm-seeding';
|
||||||
|
import { config } from '../config';
|
||||||
import { User } from '../models/entities/User';
|
import { User } from '../models/entities/User';
|
||||||
|
import SeedTestRunners from '../seeds/SeedTestRunners';
|
||||||
import SeedUsers from '../seeds/SeedUsers';
|
import SeedUsers from '../seeds/SeedUsers';
|
||||||
/**
|
/**
|
||||||
* Loader for the database that creates the database connection and initializes the database tabels.
|
* Loader for the database that creates the database connection and initializes the database tabels.
|
||||||
@ -12,5 +14,8 @@ export default async () => {
|
|||||||
if (await connection.getRepository(User).count() === 0) {
|
if (await connection.getRepository(User).count() === 0) {
|
||||||
await runSeeder(SeedUsers);
|
await runSeeder(SeedUsers);
|
||||||
}
|
}
|
||||||
|
if (config.seedTestData) {
|
||||||
|
await runSeeder(SeedTestRunners);
|
||||||
|
}
|
||||||
return connection;
|
return connection;
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user