feat(medusa): Improve config loading (#1290)

This commit is contained in:
Adrien de Peretti authored and GitHub committed 2022-04-21 12:49:56 +02:00
1 parent 89a6de4660
commit 313cb0658b
25 files changed
+225 -175

No files matched your search

@@ -28,7 +28,7 @@ export const simpleProductFactory = async (
connection: Connection,
data: ProductFactoryData = {},
seed?: number
): Promise<Product> => {
): Promise<Product | undefined> => {
if (typeof seed !== "undefined") {
faker.seed(seed)
}
@@ -50,9 +50,9 @@ export const simpleProductFactory = async (
status: data.status,
is_giftcard: data.is_giftcard || false,
discountable: !data.is_giftcard,
tags: [],
profile_id: data.is_giftcard ? gcProfile.id : defaultProfile.id,
}
tags: [] as ProductTag[],
profile_id: data.is_giftcard ? gcProfile?.id : defaultProfile?.id,
} as Product
if (typeof data.tags !== "undefined") {
for (let i = 0; i < data.tags.length; i++) {
@@ -112,5 +112,5 @@ export const simpleProductFactory = async (
await simpleProductVariantFactory(connection, factoryData)
}
return await manager.findOne(Product, { id: prodId }, { relations: ["tags"] })
return manager.findOne(Product, { id: prodId }, { relations: ["tags"] })
}
+2
View File
@@ -8,5 +8,7 @@ module.exports = {
// redis_url: REDIS_URL,
database_url: `postgres://${DB_USERNAME}:${DB_PASSWORD}@localhost/medusa-integration-${workerId}`,
database_type: "postgres",
jwt_secret: 'test',
cookie_secret: 'test'
},
}