mirror of https://github.com/voidlizard/hbs2
fixed wrong-default-config-path
This commit is contained in:
parent
8fb6fc1281
commit
73bf0e9f17
|
@ -153,4 +153,6 @@ fixme-merged "H9Hiq71jji" "DFYZXyqCyr"
|
||||||
fixme-set "workflow" "backlog" "9v1QCP5JAL"
|
fixme-set "workflow" "backlog" "9v1QCP5JAL"
|
||||||
fixme-set "workflow" "backlog" "G9xp6QQkRE"
|
fixme-set "workflow" "backlog" "G9xp6QQkRE"
|
||||||
|
|
||||||
fixme-merged "AmtqsgpimE" "AEuRHd5sWC"
|
fixme-merged "AmtqsgpimE" "AEuRHd5sWC"
|
||||||
|
fixme-set "workflow" "wip" "DZyVAuBYzB"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
## 2023-02-15
|
## 2023-02-15
|
||||||
|
|
||||||
|
FIXME: wrong-default-config-path
|
||||||
|
|
||||||
TODO: make-key-optional-parameter
|
TODO: make-key-optional-parameter
|
||||||
|
|
||||||
-k should be an optional parameter
|
-k should be an optional parameter
|
||||||
|
|
|
@ -77,9 +77,11 @@ peerConfigRead mbfp = do
|
||||||
|
|
||||||
xdg <- peerConfigDefault
|
xdg <- peerConfigDefault
|
||||||
|
|
||||||
let cfgPath = fromMaybe xdg mbfp </> cfgName
|
let cfgPath = fromMaybe xdg mbfp
|
||||||
let dir = takeDirectory cfgPath
|
let dir = takeDirectory cfgPath
|
||||||
|
|
||||||
|
debug $ "searching config" <+> pretty cfgPath
|
||||||
|
|
||||||
here <- liftIO $ doesFileExist cfgPath
|
here <- liftIO $ doesFileExist cfgPath
|
||||||
|
|
||||||
if not here then do
|
if not here then do
|
||||||
|
@ -91,7 +93,11 @@ peerConfigRead mbfp = do
|
||||||
-- FIXME: config-parse-error-handling
|
-- FIXME: config-parse-error-handling
|
||||||
-- Handle parse errors
|
-- Handle parse errors
|
||||||
|
|
||||||
confData <- liftIO $ readFile cfgPath <&> parseTop
|
debug $ pretty cfgPath
|
||||||
|
|
||||||
|
confData <- liftIO $ readFile cfgPath <&> parseTop <&> either mempty id
|
||||||
|
|
||||||
|
debug $ pretty confData
|
||||||
|
|
||||||
config <- flip transformBiM confData $ \case
|
config <- flip transformBiM confData $ \case
|
||||||
List co (Key "key" [LitStrVal p]) -> do
|
List co (Key "key" [LitStrVal p]) -> do
|
||||||
|
@ -104,7 +110,7 @@ peerConfigRead mbfp = do
|
||||||
|
|
||||||
x -> pure x
|
x -> pure x
|
||||||
|
|
||||||
pure $ PeerConfig $ fromRight mempty config
|
pure $ PeerConfig config
|
||||||
|
|
||||||
|
|
||||||
instance {-# OVERLAPPABLE #-} (IsString b, HasCfgKey a (Maybe b)) => HasCfgValue a (Maybe b) where
|
instance {-# OVERLAPPABLE #-} (IsString b, HasCfgKey a (Maybe b)) => HasCfgValue a (Maybe b) where
|
||||||
|
|
Loading…
Reference in New Issue