@@ -38,6 +38,7 @@ module Cardano.DbSync.Config.Types (
3838 PlutusConfig (.. ),
3939 GovernanceConfig (.. ),
4040 OffchainPoolDataConfig (.. ),
41+ OffChainUserAgent (.. ),
4142 JsonTypeConfig (.. ),
4243 SnapshotIntervalConfig (.. ),
4344 LedgerStateDir (.. ),
@@ -192,6 +193,7 @@ data SyncInsertOptions = SyncInsertOptions
192193 , sioPoolStats :: PoolStatsConfig
193194 , sioJsonType :: JsonTypeConfig
194195 , sioRemoveJsonbFromSchema :: RemoveJsonbFromSchemaConfig
196+ , sioOffchainUserAgent :: OffChainUserAgent
195197 , sioStopAtBlock :: Maybe Word64
196198 }
197199 deriving (Eq , Show )
@@ -266,6 +268,12 @@ newtype OffchainPoolDataConfig = OffchainPoolDataConfig
266268 }
267269 deriving (Eq , Show )
268270
271+ newtype OffChainUserAgent = OffChainUserAgent
272+ { unOffChainUserAgent :: Maybe Text
273+ }
274+ deriving (Eq , Show )
275+ deriving newtype (ToJSON , FromJSON )
276+
269277newtype RemoveJsonbFromSchemaConfig = RemoveJsonbFromSchemaConfig
270278 { isRemoveJsonbFromSchemaEnabled :: Bool
271279 }
@@ -465,6 +473,7 @@ parseOverrides obj baseOptions = do
465473 <*> obj .:? " pool_stat" .!= sioPoolStats baseOptions
466474 <*> obj .:? " json_type" .!= sioJsonType baseOptions
467475 <*> obj .:? " remove_jsonb_from_schema" .!= sioRemoveJsonbFromSchema baseOptions
476+ <*> obj .:? " offchain_user_agent" .!= sioOffchainUserAgent baseOptions
468477 <*> obj .:? " stop_at_block" .!= sioStopAtBlock baseOptions
469478
470479instance ToJSON SyncInsertConfig where
@@ -487,6 +496,7 @@ optionsToList SyncInsertOptions {..} =
487496 , toJsonIfSet " pool_stat" sioPoolStats
488497 , toJsonIfSet " json_type" sioJsonType
489498 , toJsonIfSet " remove_jsonb_from_schema" sioRemoveJsonbFromSchema
499+ , toJsonIfSet " offchain_user_agent" sioOffchainUserAgent
490500 , toJsonIfSet " stop_at_block" sioStopAtBlock
491501 ]
492502
@@ -509,6 +519,7 @@ instance FromJSON SyncInsertOptions where
509519 <*> obj .:? " pool_stat" .!= sioPoolStats def
510520 <*> obj .:? " json_type" .!= sioJsonType def
511521 <*> obj .:? " remove_jsonb_from_schema" .!= sioRemoveJsonbFromSchema def
522+ <*> obj .:? " offchain_user_agent" .!= sioOffchainUserAgent def
512523 <*> obj .:? " stop_at_block" .!= sioStopAtBlock def
513524
514525instance ToJSON SyncInsertOptions where
@@ -526,6 +537,7 @@ instance ToJSON SyncInsertOptions where
526537 , " pool_stat" .= sioPoolStats
527538 , " json_type" .= sioJsonType
528539 , " remove_jsonb_from_schema" .= sioRemoveJsonbFromSchema
540+ , " offchain_user_agent" .= sioOffchainUserAgent
529541 , " stop_at_block" .= sioStopAtBlock
530542 ]
531543
@@ -773,6 +785,7 @@ instance Default SyncInsertOptions where
773785 , sioPoolStats = PoolStatsConfig False
774786 , sioJsonType = JsonTypeText
775787 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
788+ , sioOffchainUserAgent = OffChainUserAgent Nothing
776789 , sioStopAtBlock = Nothing
777790 }
778791
@@ -792,6 +805,7 @@ fullInsertOptions =
792805 , sioPoolStats = PoolStatsConfig True
793806 , sioJsonType = JsonTypeText
794807 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
808+ , sioOffchainUserAgent = OffChainUserAgent Nothing
795809 , sioStopAtBlock = Nothing
796810 }
797811
@@ -811,6 +825,7 @@ onlyUTxOInsertOptions =
811825 , sioPoolStats = PoolStatsConfig False
812826 , sioJsonType = JsonTypeText
813827 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
828+ , sioOffchainUserAgent = OffChainUserAgent Nothing
814829 , sioStopAtBlock = Nothing
815830 }
816831
@@ -838,6 +853,7 @@ disableAllInsertOptions =
838853 , sioGovernance = GovernanceConfig False
839854 , sioJsonType = JsonTypeText
840855 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
856+ , sioOffchainUserAgent = OffChainUserAgent Nothing
841857 , sioStopAtBlock = Nothing
842858 }
843859
0 commit comments