about summary refs log tree commit diff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-30T12·58+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-30T12·58+0100
commitb6e8389edd486d407025383825a1beaf6b7f63b7 (patch)
treeb38c6fd1231bce0548be7557f2e509cea84b66c1 /src/Main.hs
parent385164c6afea7995b797cf8ddddefa187c26f646 (diff)
Read env variables using envy library
Using my dear friend's, dmjio's, excellent library, envy -- to read and parse
variables from the system environment.

I added and git-ignored the .envrc file that contains API secrets. I'm using
Envy to read these values, so that I don't hard-code these values into the
source code.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index de40b3225e4a..9df4232066bb 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -1,7 +1,13 @@
+--------------------------------------------------------------------------------
 module Main where
 --------------------------------------------------------------------------------
 import qualified App
+import qualified System.Envy as Envy
 --------------------------------------------------------------------------------
 
 main :: IO ()
-main = App.run "../db.sqlite3"
+main = do
+  mEnv <- Envy.decodeEnv
+  case mEnv of
+    Left err -> putStrLn err
+    Right env -> App.run env