2020-01-23 07:16:09 +03:00
|
|
|
{-|
|
|
|
|
Pier Configuration
|
|
|
|
-}
|
2020-01-24 08:28:38 +03:00
|
|
|
module Urbit.King.Config where
|
2019-10-22 21:25:04 +03:00
|
|
|
|
2020-01-24 08:28:38 +03:00
|
|
|
import Urbit.Prelude
|
2019-10-22 21:25:04 +03:00
|
|
|
|
2020-01-23 07:16:09 +03:00
|
|
|
{-|
|
2019-12-17 17:31:50 +03:00
|
|
|
All the configuration data revolving around a ship and the current
|
|
|
|
execution options.
|
|
|
|
-}
|
2019-10-22 21:25:04 +03:00
|
|
|
data PierConfig = PierConfig
|
2019-12-17 17:31:50 +03:00
|
|
|
{ _pcPierPath :: FilePath
|
|
|
|
, _pcDryRun :: Bool
|
|
|
|
} deriving (Show)
|
|
|
|
|
|
|
|
makeLenses ''PierConfig
|
2019-10-22 21:25:04 +03:00
|
|
|
|
|
|
|
class HasPierConfig env where
|
|
|
|
pierConfigL :: Lens' env PierConfig
|
|
|
|
|
2019-12-17 17:31:50 +03:00
|
|
|
pierPathL ∷ HasPierConfig a => Lens' a FilePath
|
|
|
|
pierPathL = pierConfigL . pcPierPath
|
2019-10-22 21:25:04 +03:00
|
|
|
|
2019-12-17 17:31:50 +03:00
|
|
|
dryRunL :: HasPierConfig a => Lens' a Bool
|
|
|
|
dryRunL = pierConfigL . pcDryRun
|
2019-10-22 21:25:04 +03:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2020-03-03 02:24:28 +03:00
|
|
|
data NetMode
|
|
|
|
= NMNone
|
|
|
|
| NMLocalhost
|
|
|
|
| NMNormal
|
|
|
|
deriving (Eq, Ord, Show)
|
2019-10-22 21:25:04 +03:00
|
|
|
|
|
|
|
data NetworkConfig = NetworkConfig
|
2020-03-03 02:24:28 +03:00
|
|
|
{ _ncNetMode :: NetMode
|
|
|
|
, _ncAmesPort :: Maybe Word16
|
|
|
|
, _ncHttpPort :: Maybe Word16
|
|
|
|
, _ncHttpsPort :: Maybe Word16
|
|
|
|
, _ncLocalPort :: Maybe Word16
|
2019-10-22 21:25:04 +03:00
|
|
|
} deriving (Show)
|
|
|
|
|
2020-03-03 02:24:28 +03:00
|
|
|
makeLenses ''NetworkConfig
|
|
|
|
|
2019-10-22 21:25:04 +03:00
|
|
|
class HasNetworkConfig env where
|
|
|
|
networkConfigL :: Lens' env NetworkConfig
|