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
|
# Binary name built by nimble
|
||||||
nimblog
|
nimblog
|
||||||
|
|
||||||
# Database
|
# Blog data
|
||||||
blog.db
|
data/*
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import tables
|
import tables
|
||||||
import modules/blog
|
import os
|
||||||
import modules/env
|
import modules/[blog, env, db]
|
||||||
import modules/db
|
|
||||||
|
let dataDir: string = "data"
|
||||||
|
|
||||||
let settings = {
|
let settings = {
|
||||||
"debug": boolEnvOrDefault("DEBUG", false),
|
"debug": boolEnvOrDefault("DEBUG", false),
|
||||||
|
@ -10,10 +11,14 @@ when isMainModule:
|
||||||
}.toTable()
|
}.toTable()
|
||||||
|
|
||||||
let dbSettings = {
|
let dbSettings = {
|
||||||
"path": "blog.db",
|
"path": dataDir & "/" & "blog.db",
|
||||||
"schema_path": "schema.sql"
|
"schema_path": "schema.sql"
|
||||||
}.toTable()
|
}.toTable()
|
||||||
|
|
||||||
|
if not dirExists(dataDir):
|
||||||
|
echo "Created data directory"
|
||||||
|
createDir(dataDir)
|
||||||
|
|
||||||
if not createDb(dbSettings):
|
if not createDb(dbSettings):
|
||||||
echo "Failed to prepare database"
|
echo "Failed to prepare database"
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
|
|
Loading…
Reference in New Issue