Move stuff to data folder, so I can just gitignore that entire folder
This commit is contained in:
parent
88cbeee562
commit
7c484b18d3
|
@ -4,5 +4,5 @@
|
|||
# Binary name built by nimble
|
||||
nimblog
|
||||
|
||||
# Database
|
||||
blog.db
|
||||
# Blog data
|
||||
data/*
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
when isMainModule:
|
||||
import tables
|
||||
import modules/blog
|
||||
import modules/env
|
||||
import modules/db
|
||||
import os
|
||||
import modules/[blog, env, db]
|
||||
|
||||
let dataDir: string = "data"
|
||||
|
||||
let settings = {
|
||||
"debug": boolEnvOrDefault("DEBUG", false),
|
||||
|
@ -10,10 +11,14 @@ when isMainModule:
|
|||
}.toTable()
|
||||
|
||||
let dbSettings = {
|
||||
"path": "blog.db",
|
||||
"path": dataDir & "/" & "blog.db",
|
||||
"schema_path": "schema.sql"
|
||||
}.toTable()
|
||||
|
||||
if not dirExists(dataDir):
|
||||
echo "Created data directory"
|
||||
createDir(dataDir)
|
||||
|
||||
if not createDb(dbSettings):
|
||||
echo "Failed to prepare database"
|
||||
quit(QuitFailure)
|
||||
|
|
Loading…
Reference in New Issue