@@ -38,6 +38,7 @@ module Cardano.DbSync.Config.Types (
3838 PlutusConfig (.. ),
3939 GovernanceConfig (.. ),
4040 OffchainPoolDataConfig (.. ),
41+ OffChainUserAgent (.. ),
4142 JsonTypeConfig (.. ),
4243 LedgerStateDir (.. ),
4344 LogFileDir (.. ),
@@ -189,6 +190,7 @@ data SyncInsertOptions = SyncInsertOptions
189190 , sioPoolStats :: PoolStatsConfig
190191 , sioJsonType :: JsonTypeConfig
191192 , sioRemoveJsonbFromSchema :: RemoveJsonbFromSchemaConfig
193+ , sioOffchainUserAgent :: OffChainUserAgent
192194 , sioStopAtBlock :: Maybe Word64
193195 }
194196 deriving (Eq , Show )
@@ -263,6 +265,12 @@ newtype OffchainPoolDataConfig = OffchainPoolDataConfig
263265 }
264266 deriving (Eq , Show )
265267
268+ newtype OffChainUserAgent = OffChainUserAgent
269+ { unOffChainUserAgent :: Maybe Text
270+ }
271+ deriving (Eq , Show )
272+ deriving newtype (ToJSON , FromJSON )
273+
266274newtype RemoveJsonbFromSchemaConfig = RemoveJsonbFromSchemaConfig
267275 { isRemoveJsonbFromSchemaEnabled :: Bool
268276 }
@@ -456,6 +464,7 @@ parseOverrides obj baseOptions = do
456464 <*> obj .:? " pool_stat" .!= sioPoolStats baseOptions
457465 <*> obj .:? " json_type" .!= sioJsonType baseOptions
458466 <*> obj .:? " remove_jsonb_from_schema" .!= sioRemoveJsonbFromSchema baseOptions
467+ <*> obj .:? " offchain_user_agent" .!= sioOffchainUserAgent baseOptions
459468 <*> obj .:? " stop_at_block" .!= sioStopAtBlock baseOptions
460469
461470instance ToJSON SyncInsertConfig where
@@ -478,6 +487,7 @@ optionsToList SyncInsertOptions {..} =
478487 , toJsonIfSet " pool_stat" sioPoolStats
479488 , toJsonIfSet " json_type" sioJsonType
480489 , toJsonIfSet " remove_jsonb_from_schema" sioRemoveJsonbFromSchema
490+ , toJsonIfSet " offchain_user_agent" sioOffchainUserAgent
481491 , toJsonIfSet " stop_at_block" sioStopAtBlock
482492 ]
483493
@@ -500,6 +510,7 @@ instance FromJSON SyncInsertOptions where
500510 <*> obj .:? " pool_stat" .!= sioPoolStats def
501511 <*> obj .:? " json_type" .!= sioJsonType def
502512 <*> obj .:? " remove_jsonb_from_schema" .!= sioRemoveJsonbFromSchema def
513+ <*> obj .:? " offchain_user_agent" .!= sioOffchainUserAgent def
503514 <*> obj .:? " stop_at_block" .!= sioStopAtBlock def
504515
505516instance ToJSON SyncInsertOptions where
@@ -517,6 +528,7 @@ instance ToJSON SyncInsertOptions where
517528 , " pool_stat" .= sioPoolStats
518529 , " json_type" .= sioJsonType
519530 , " remove_jsonb_from_schema" .= sioRemoveJsonbFromSchema
531+ , " offchain_user_agent" .= sioOffchainUserAgent
520532 , " stop_at_block" .= sioStopAtBlock
521533 ]
522534
@@ -747,6 +759,7 @@ instance Default SyncInsertOptions where
747759 , sioPoolStats = PoolStatsConfig False
748760 , sioJsonType = JsonTypeText
749761 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
762+ , sioOffchainUserAgent = OffChainUserAgent Nothing
750763 , sioStopAtBlock = Nothing
751764 }
752765
@@ -766,6 +779,7 @@ fullInsertOptions =
766779 , sioPoolStats = PoolStatsConfig True
767780 , sioJsonType = JsonTypeText
768781 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
782+ , sioOffchainUserAgent = OffChainUserAgent Nothing
769783 , sioStopAtBlock = Nothing
770784 }
771785
@@ -785,6 +799,7 @@ onlyUTxOInsertOptions =
785799 , sioPoolStats = PoolStatsConfig False
786800 , sioJsonType = JsonTypeText
787801 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
802+ , sioOffchainUserAgent = OffChainUserAgent Nothing
788803 , sioStopAtBlock = Nothing
789804 }
790805
@@ -812,6 +827,7 @@ disableAllInsertOptions =
812827 , sioGovernance = GovernanceConfig False
813828 , sioJsonType = JsonTypeText
814829 , sioRemoveJsonbFromSchema = RemoveJsonbFromSchemaConfig False
830+ , sioOffchainUserAgent = OffChainUserAgent Nothing
815831 , sioStopAtBlock = Nothing
816832 }
817833
0 commit comments