Skip to content

Commit

Permalink
adds single data path for db and events
Browse files Browse the repository at this point in the history
  • Loading branch information
brase committed Feb 29, 2020
1 parent 1042670 commit 1627c49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Server/Database.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ module Database =
| head::tail -> Some head
| [] -> None

let createDatabaseConnection() =
let createDatabaseConnection folderName =
let folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
let filePath = System.IO.Path.Combine(folder, folderName, "database.db")
let mapper = FSharpBsonMapper()
let db = new LiteDatabase("murocast.db", mapper) //TODO: DB is IDisposable
let db = new LiteDatabase(filePath, mapper) //TODO: DB is IDisposable

{ AddAuthRequest = addAuthRequest db
GetAuthRequestByLinkToken = getAuthRequest db
Expand Down
6 changes: 4 additions & 2 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ open CosmoStore

let publicPath = Path.GetFullPath "../Client/public"
let port = 80us
[<Literal>]
let DataFolder = "Castos"

let eventStore = { LiteDb.Configuration.Empty with
StoreType = LiteDb.LocalDB
Folder = "Castos" }
Folder = DataFolder }
|> LiteDb.EventStore.getEventStore

let db = Database.createDatabaseConnection()
let db = Database.createDatabaseConnection DataFolder

let webApp = router {

Expand Down

0 comments on commit 1627c49

Please sign in to comment.