Skip to content

Commit

Permalink
Merge pull request #18 from tchoutri/embed-confer-api
Browse files Browse the repository at this point in the history
Remove runtime dependency on confer.lua
  • Loading branch information
tchoutri authored Jul 17, 2024
2 parents 5f14048 + a9b224a commit ac7dd00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions confer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ library
, effectful
, effectful-core
, extra
, file-embed
, filepath
, hostname
, hslua-aeson
Expand Down
15 changes: 9 additions & 6 deletions src/Confer/Config/Evaluator.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE TemplateHaskell #-}

module Confer.Config.Evaluator
( loadConfiguration
, adjustConfiguration
Expand Down Expand Up @@ -32,6 +34,7 @@ import System.OsPath.Encoding qualified as OsPath
import Confer.API.Host qualified as API
import Confer.API.User qualified as API
import Confer.Config.Types
import Data.FileEmbed (embedFile)

adjustConfiguration
:: Text
Expand Down Expand Up @@ -60,12 +63,12 @@ loadConfiguration verbose pathToConfigFile = do
hostModule <- API.mkHostModule
liftIO $ Lua.run $ do
Lua.openlibs -- load the default Lua packages
conferLuaFilePath <- liftIO $ getDataFileName "runtime/lua/confer.lua"
when verbose $
liftIO $
Text.putStrLn $
"Loading " <> Text.pack conferLuaFilePath
Lua.dofile (Just conferLuaFilePath)
let conferLua = $(embedFile "runtime/lua/confer.lua")
-- when verbose $
-- liftIO $
-- Text.putStrLn $
-- "Loading " <> Text.pack conferLuaFilePath
Lua.dostring conferLua
Lua.setglobal "confer"
Lua.registerModule Lua.System.documentedModule
Lua.registerModule userModule
Expand Down

0 comments on commit ac7dd00

Please sign in to comment.