mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 09:51:36 +03:00
9ec9426b8a
When -N is enabled, no sockets are bound and no events get persisted to the datastore. We also pass the dry run flag to the serf, who should not snapshot. (For redundancy, we should probably also make king not send the save snapshot commands, but I tested locally that the worker process doesn't save.)
39 lines
1.0 KiB
Haskell
39 lines
1.0 KiB
Haskell
module PierConfig where
|
|
|
|
import UrbitPrelude
|
|
|
|
data NetworkingType = NetworkNone | NetworkNormal | NetworkLocalhost
|
|
|
|
-- All the configuration data revolving around a ship and the current execution
|
|
-- options.
|
|
data PierConfig = PierConfig
|
|
{ pcPierPath :: FilePath
|
|
, pcDryRun :: Bool
|
|
-- Configurable networking options
|
|
, pcNetworking :: NetworkingType
|
|
, pcAmesPort :: Maybe Word16
|
|
}
|
|
|
|
class HasPierConfig env where
|
|
pierConfigL :: Lens' env PierConfig
|
|
|
|
getPierPath :: (MonadReader env m, HasPierConfig env) => m FilePath
|
|
getPierPath = do
|
|
PierConfig{..} <- view pierConfigL
|
|
pure pcPierPath
|
|
|
|
getIsDryRun :: (MonadReader env m, HasPierConfig env) => m Bool
|
|
getIsDryRun = do
|
|
PierConfig{..} <- view pierConfigL
|
|
pure pcDryRun
|
|
|
|
getNetworkingType :: (MonadReader env m, HasPierConfig env) => m NetworkingType
|
|
getNetworkingType = do
|
|
PierConfig{..} <- view pierConfigL
|
|
pure pcNetworking
|
|
|
|
getAmesPort :: (MonadReader env m, HasPierConfig env) => m (Maybe Word16)
|
|
getAmesPort = do
|
|
PierConfig{..} <- view pierConfigL
|
|
pure pcAmesPort
|