From 2c369943e7c1633cfacdf1a8f5e1059fac50d6cf Mon Sep 17 00:00:00 2001 From: Mats Rauhala Date: Mon, 21 Jan 2019 22:35:05 +0200 Subject: [PATCH] Migrations configuration --- backend/src/Configuration.hs | 3 ++- config/Configuration.dhall | 7 +++++++ config/config.dhall.sample | 2 ++ to-flyway.dhall | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 config/Configuration.dhall create mode 100644 to-flyway.dhall diff --git a/backend/src/Configuration.hs b/backend/src/Configuration.hs index d9a3503..42ed217 100644 --- a/backend/src/Configuration.hs +++ b/backend/src/Configuration.hs @@ -9,7 +9,8 @@ import Dhall (Interpret) data Pg = Pg { username :: Text , password :: Text , host :: Text - , database :: Text } + , database :: Text + , migrations :: Text } deriving (Show, Generic) data Store = Filestore { path :: Text } diff --git a/config/Configuration.dhall b/config/Configuration.dhall new file mode 100644 index 0000000..cac7a80 --- /dev/null +++ b/config/Configuration.dhall @@ -0,0 +1,7 @@ +{ database : { username : Text + , password : Text + , host : Text + , database : Text + , migrations : Text } +, store : { path : Text } +} diff --git a/config/config.dhall.sample b/config/config.dhall.sample index 860aedd..8e3b9bb 100644 --- a/config/config.dhall.sample +++ b/config/config.dhall.sample @@ -4,5 +4,7 @@ , password = "password" , host = "hostname" , database = "ebook" + , migrations = "./migrations" } + store = { path = "/tmp/store" } } diff --git a/to-flyway.dhall b/to-flyway.dhall new file mode 100644 index 0000000..1207fbb --- /dev/null +++ b/to-flyway.dhall @@ -0,0 +1,8 @@ +\(conf : ./config/Configuration.dhall) +-> +'' +flyway.locations=filesystem:${conf.database.migrations}/ +flyway.url=jdbc:postgresql://${conf.database.host}/${conf.database.database} +flyway.user=${conf.database.username} +flyway.password=${conf.database.password} +''