@@ -628,39 +628,96 @@ pg_pool_opts(PoolOpts) ->
628628
629629progressor (YamlConfig ) ->
630630 PrgNamespaces = lists :foldl (
631- fun ({NsName , NsPgPool }, Acc ) ->
632- Acc #{? C :atom (NsName ) => prg_namespace (? C : atom ( NsPgPool ) )}
631+ fun ({NsName , NsOpts }, Acc ) ->
632+ Acc #{? C :atom (NsName ) => prg_namespace (NsOpts )}
633633 end ,
634634 #{},
635635 ? C :conf ([progressor ], YamlConfig , [])
636636 ),
637- [{namespaces , PrgNamespaces }].
637+ [{namespaces , PrgNamespaces }, { migration_enabled , false } ].
638638
639- prg_namespace (NsPgPool ) ->
640- #{
641- storage => #{
642- client => prg_pg_backend ,
643- options => #{pool => NsPgPool }
644- },
645- processor => #{
646- % % Never will be called
647- client => null
648- },
639+ prg_namespace (NsOptsList ) ->
640+ InitAcc = #{
641+ processor => #{client => null },
649642 worker_pool_size => 0
643+ },
644+ lists :foldl (
645+ fun
646+ ({<<" storage" >>, StorageOpts }, Acc ) -> Acc #{storage => prg_storage_opts (StorageOpts )};
647+ ({<<" notifier" >>, NotifierOpts }, Acc ) -> Acc #{notifier => prg_notifier_opts (NotifierOpts )};
648+ (_ , Acc ) -> Acc
649+ end ,
650+ InitAcc ,
651+ NsOptsList
652+ ).
653+
654+ prg_storage_opts (StorageOpts ) ->
655+ Client = ? C :atom (? C :conf ([client ], StorageOpts , <<" prg_pg_backend" >>)),
656+ OptsList = ? C :conf ([options ], StorageOpts ),
657+ #{
658+ client => Client ,
659+ options => prg_storage_handler_opts (Client , OptsList )
660+ }.
661+
662+ prg_storage_handler_opts (prg_pg_backend , OptsList ) ->
663+ #{pool => ? C :atom (? C :conf ([pool ], OptsList ))}.
664+
665+ prg_notifier_opts (NotifierOpts ) ->
666+ Client = ? C :atom (? C :conf ([client ], NotifierOpts )),
667+ OptsList = ? C :conf ([options ], NotifierOpts ),
668+ #{
669+ client => Client ,
670+ options => #{
671+ topic => ? C :conf ([topic ], OptsList ),
672+ lifecycle_topic => ? C :conf ([lifecycle_topic ], OptsList )
673+ }
650674 }.
651675
652676canal (YamlConfig ) ->
677+ Default = [
678+ {httpc_options , [{ssl , [{verify , verify_none }]}]},
679+ {kvv2_secret_mount_path , " /secret/data/" }
680+ ],
653681 lists :foldl (
654682 fun
655683 ({<<" url" >>, Url }, Acc ) ->
656684 [{url , unicode :characters_to_list (Url )} | Acc ];
657685 ({<<" engine" >>, Value }, Acc ) ->
658- [{engine , ? C :atom (Value )} | Acc ]
686+ [{engine , ? C :atom (Value )} | Acc ];
687+ ({<<" httpc_options" >>, Value }, Acc ) ->
688+ [{httpc_options , canal_httpc_options (Value )} | Acc ];
689+ ({<<" kvv2_secret_mount_path" >>, Value }, Acc ) ->
690+ [{kvv2_secret_mount_path , unicode :characters_to_list (Value )} | Acc ]
659691 end ,
660- [] ,
692+ Default ,
661693 ? C :conf ([canal ], YamlConfig , [])
662694 ).
663695
696+ canal_httpc_options (Value ) ->
697+ lists :foldl (
698+ fun
699+ ({<<" ssl" >>, SslOpts }, Acc ) ->
700+ [{ssl , ssl_opts (SslOpts )} | Acc ];
701+ (_ , Acc ) ->
702+ Acc
703+ end ,
704+ [],
705+ Value
706+ ).
707+
708+ ssl_opts (Opts ) ->
709+ Default = [{ssl , [{verify , verify_none }]}],
710+ lists :foldl (
711+ fun
712+ ({<<" verify" >>, Value }, Acc ) ->
713+ [{verify , ? C :atom (Value )} | Acc ];
714+ (_ , Acc ) ->
715+ Acc
716+ end ,
717+ Default ,
718+ Opts
719+ ).
720+
664721% %
665722% % vm.args
666723% %
0 commit comments