mirror of https://github.com/voidlizard/hbs2
default config
This commit is contained in:
parent
eba484575c
commit
9518a4b1c7
|
@ -158,3 +158,4 @@ fixme-set "workflow" "wip" "DZyVAuBYzB"
|
||||||
|
|
||||||
|
|
||||||
fixme-set "workflow" "test" "DTZ2RqeN7y"
|
fixme-set "workflow" "test" "DTZ2RqeN7y"
|
||||||
|
fixme-set "workflow" "test" "84iLJsvCtT"
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
## 2023-02-15
|
## 2023-02-15
|
||||||
|
|
||||||
|
FIXME: create-default-config
|
||||||
|
|
||||||
FIXME: wrong-default-config-path
|
FIXME: wrong-default-config-path
|
||||||
|
|
||||||
TODO: make-key-optional-parameter
|
TODO: make-key-optional-parameter
|
||||||
|
|
|
@ -23,6 +23,7 @@ import System.FilePath
|
||||||
import Data.Set qualified as Set
|
import Data.Set qualified as Set
|
||||||
import Data.Set (Set)
|
import Data.Set (Set)
|
||||||
import Data.Text qualified as Text
|
import Data.Text qualified as Text
|
||||||
|
import Text.InterpolatedString.Perl6 (qc)
|
||||||
|
|
||||||
class HasCfgKey a b where
|
class HasCfgKey a b where
|
||||||
-- type family CfgValue a :: Type
|
-- type family CfgValue a :: Type
|
||||||
|
@ -53,9 +54,21 @@ peerConfigDefault = liftIO $
|
||||||
catchAny :: IO a -> (SomeException -> IO a) -> IO a
|
catchAny :: IO a -> (SomeException -> IO a) -> IO a
|
||||||
catchAny = Control.Exception.catch
|
catchAny = Control.Exception.catch
|
||||||
|
|
||||||
|
defConfigData :: String
|
||||||
|
defConfigData = [qc|
|
||||||
|
|
||||||
peerConfigInit :: Maybe FilePath -> IO ()
|
listen "0.0.0.0:7351"
|
||||||
peerConfigInit mbfp = do
|
rpc "127.0.0.1:13331"
|
||||||
|
|
||||||
|
; default storage is $HOME/.local/share/hbs2
|
||||||
|
; storage "./storage"
|
||||||
|
|
||||||
|
; edit path to a keyring file
|
||||||
|
; key "./key"
|
||||||
|
|]
|
||||||
|
|
||||||
|
peerConfigInit :: MonadIO m => Maybe FilePath -> m ()
|
||||||
|
peerConfigInit mbfp = liftIO do
|
||||||
debug $ "peerConfigInit" <+> pretty mbfp
|
debug $ "peerConfigInit" <+> pretty mbfp
|
||||||
|
|
||||||
defDir <- peerConfigDefault <&> takeDirectory
|
defDir <- peerConfigDefault <&> takeDirectory
|
||||||
|
@ -70,9 +83,13 @@ peerConfigInit mbfp = do
|
||||||
|
|
||||||
unless here do
|
unless here do
|
||||||
appendFile (dir</>cfgName) ";; hbs2-peer config file"
|
appendFile (dir</>cfgName) ";; hbs2-peer config file"
|
||||||
|
appendFile (dir</>cfgName) defConfigData
|
||||||
|
|
||||||
peerConfigRead :: MonadIO m => Maybe FilePath -> m PeerConfig
|
peerConfigRead :: MonadIO m => Maybe FilePath -> m PeerConfig
|
||||||
peerConfigRead mbfp = do
|
peerConfigRead mbfp = do
|
||||||
|
|
||||||
|
peerConfigInit mbfp
|
||||||
|
|
||||||
debug $ "peerConfigRead" <+> pretty mbfp
|
debug $ "peerConfigRead" <+> pretty mbfp
|
||||||
|
|
||||||
xdg <- peerConfigDefault
|
xdg <- peerConfigDefault
|
||||||
|
|
|
@ -51,6 +51,7 @@ common common-deps
|
||||||
, uniplate
|
, uniplate
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
, vector
|
, vector
|
||||||
|
, interpolatedstring-perl6
|
||||||
|
|
||||||
common shared-properties
|
common shared-properties
|
||||||
ghc-options:
|
ghc-options:
|
||||||
|
|
Loading…
Reference in New Issue