diff options
| author | LLLL Colonq <llll@colonq> | 2024-03-19 03:37:33 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-03-19 03:37:33 -0400 |
| commit | fbabf1d29a8a97d57d9609666c81701fe12979e1 (patch) | |
| tree | c9e7f4c0185dedf084558aeeea69140a326a19ef /fig-frontend/src/Fig/Frontend | |
| parent | 7aa60d33eff21ccdaa31ccd5dd64196990bb3dea (diff) | |
Update
Diffstat (limited to 'fig-frontend/src/Fig/Frontend')
| -rw-r--r-- | fig-frontend/src/Fig/Frontend/DB.hs | 7 | ||||
| -rw-r--r-- | fig-frontend/src/Fig/Frontend/Utils.hs | 10 |
2 files changed, 10 insertions, 7 deletions
diff --git a/fig-frontend/src/Fig/Frontend/DB.hs b/fig-frontend/src/Fig/Frontend/DB.hs index bcf00f2..b0f065d 100644 --- a/fig-frontend/src/Fig/Frontend/DB.hs +++ b/fig-frontend/src/Fig/Frontend/DB.hs @@ -5,10 +5,11 @@ import Control.Error.Util (hush) import qualified Database.Redis as Redis import Fig.Prelude +import Fig.Frontend.Utils -connect :: MonadIO m => m Redis.Connection -connect = liftIO $ Redis.checkedConnect Redis.defaultConnectInfo - { Redis.connectHost = "shiro" +connect :: MonadIO m => Config -> m Redis.Connection +connect cfg = liftIO $ Redis.checkedConnect Redis.defaultConnectInfo + { Redis.connectHost = unpack cfg.dbHost } get :: MonadIO m => Redis.Connection -> ByteString -> m (Maybe ByteString) diff --git a/fig-frontend/src/Fig/Frontend/Utils.hs b/fig-frontend/src/Fig/Frontend/Utils.hs index 20234e7..3081ddb 100644 --- a/fig-frontend/src/Fig/Frontend/Utils.hs +++ b/fig-frontend/src/Fig/Frontend/Utils.hs @@ -19,10 +19,11 @@ newtype FigFrontendException = FigFrontendException Text instance Exception FigFrontendException data Config = Config - { port :: Int - , assetPath :: FilePath - , clientId :: Text - , authToken :: Text + { port :: !Int + , assetPath :: !FilePath + , clientId :: !Text + , authToken :: !Text + , dbHost :: !Text } deriving (Show, Eq, Ord) configCodec :: Toml.TomlCodec Config @@ -31,6 +32,7 @@ configCodec = do assetPath <- Toml.string "asset_path" Toml..= (\a -> a.assetPath) clientId <- Toml.text "client_id" Toml..= (\a -> a.clientId) authToken <- Toml.text "auth_token" Toml..= (\a -> a.authToken) + dbHost <- Toml.text "db_host" Toml..= (\a -> a.dbHost) pure $ Config{..} loadConfig :: FilePath -> IO Config |
