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} +''