Skip to content

Commit 5db6dfc

Browse files
jbertholdgithub-actionsrv-jenkins
authored
Allow kore-rpc-booster to read additional options from KORE_RPC_OPTS (#3842)
* like `kore-rpc` , `kore-rpc-booster` should read additional options from an environment variable. * This PR chooses the same variable name as for `kore-rpc` for consistency and to avoid it getting too long. Use case: testing optional optimisation in performance tests without having to modify the pytest framework or the `KoreServer` in `pyk` --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: rv-jenkins <[email protected]>
1 parent 8a9161b commit 5db6dfc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

booster/tools/booster/Server.hs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ import System.Clock (
3939
Clock (..),
4040
getTime,
4141
)
42+
import System.Environment qualified as Env
4243
import System.Exit
4344
import System.FilePath.Glob qualified as Glob
45+
import System.IO (hPutStrLn, stderr)
4446
import System.Log.FastLogger (newTimeCache)
4547

4648
import Booster.CLOptions
@@ -92,10 +94,19 @@ import Proxy qualified
9294
import SMT qualified as KoreSMT
9395
import Stats qualified
9496

97+
envName :: String
98+
envName = "KORE_RPC_OPTS" -- aligned with legacy kore-rpc
99+
95100
main :: IO ()
96101
main = do
97102
startTime <- getTime Monotonic
98-
options <- execParser clParser
103+
options <- do
104+
Env.lookupEnv envName >>= \case
105+
Nothing -> execParser clParser
106+
Just envArgs -> do
107+
hPutStrLn stderr $ "Reading additional server options from " <> envName
108+
args <- Env.getArgs
109+
Env.withArgs (words envArgs <> args) $ execParser clParser
99110
let CLProxyOptions
100111
{ clOptions =
101112
clOPts@CLOptions

0 commit comments

Comments
 (0)