Module exposing: loadDatabaseConfig, getEnv, isModuleServiceInitializeOptions, getDefaultDriverOptions, getDatabaseUrl
// Source: https://github.com/medusajs/medusa | License: MIT | Copyright 2021 Medusajs
// Provided via justclaw.it.com; keep this notice with the code.
import { ModulesSdkTypes } from "@medusajs/types"
import { MedusaError } from "../common"
function getEnv(key: string, moduleName: string): string {
const value =
process.env[`${moduleName.toUpperCase()}_${key}`] ??
process.env[`MEDUSA_${key}`] ??
process.env[`${key}`]
return value ?? ""
}
function isModuleServiceInitializeOptions(
obj: unknown
): obj is ModulesSdkTypes.ModuleServiceInitializeOptions {
return !!(obj as any)?.database
}
function getDefaultDriverOptions(clientUrl: string) {
const localOptions = {
connection: {
ssl: false,
},
}
const remoteOptions = {
connection: {
ssl: {
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key