Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let adapter
switch (process.env.ADAPTER) {
case 'memory':
adapter = createMemoryAdapter({})
break
case 'mysql':
adapter = createMySQLAdapter({
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DATABASE,
host: process.env.MYSQL_HOST,
port: process.env.MYSQL_PORT
})
break
case 'mongo':
adapter = createMongoDBAdapter({
url: process.env.MONGO_URL
})
break
default:
throw new Error(
`Incorrect process.env.ADAPTER = ${process.env.ADAPTER}`
)
}
const storage = createStorage({
pathToFile: path.join(__dirname, 'event-storage.db')
})
const eventStore = createEventStore({ storage })
const connectorName = 'default-adapter'
const readModelName = 'default-read-model'