2020-02-03 10:24:25 +01:00
|
|
|
import local from "./datastores/local"
|
|
|
|
import azureBlob from "./datastores/azure-blob"
|
|
|
|
import memory from "./datastores/memory"
|
|
|
|
import getConfig from "./config"
|
|
|
|
import tests from "./tests"
|
2019-06-07 15:18:10 +02:00
|
|
|
|
|
|
|
const initialise = async () => {
|
2020-02-03 10:24:25 +01:00
|
|
|
const type = process.argv[2]
|
|
|
|
const config = (await getConfig())[type]
|
2019-06-07 15:18:10 +02:00
|
|
|
|
2020-02-03 10:24:25 +01:00
|
|
|
switch (type) {
|
|
|
|
case "local":
|
|
|
|
return { datastore: local(config.root), config }
|
|
|
|
case "memory":
|
|
|
|
return { datastore: memory(config), config }
|
|
|
|
case "azure":
|
|
|
|
return { datastore: azureBlob(config), config }
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
}
|
2019-06-07 15:18:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
initialise()
|
2020-02-03 10:24:25 +01:00
|
|
|
.then(init => {
|
|
|
|
return tests(init.datastore, init.config)
|
|
|
|
})
|
|
|
|
.then(_ => console.log("done"))
|
|
|
|
.catch(e => console.log(e))
|