package Ġcom . github . j nt ak pe . dev ss k ills . config Ċ Ċ import Ġcom . mongodb . ConnectionString Ċ import Ġcom . mongodb . Mongo Credential Ċ import Ġcom . mongodb . Server Address Ċ import Ġcom . mongodb . async . client . Mongo Client Settings Ċ import Ġcom . mongodb . connection . Cluster Settings Ċ import Ġcom . mongodb . connection . Ssl Settings Ċ import Ġcom . mongodb . connection . netty . Net ty Stream Factory Factory Ċ import Ġcom . mongodb . reactiv est ream s . client . Mongo Client Ċ import Ġcom . mongodb . reactiv est ream s . client . Mongo Clients Ċ import Ġorg . springframework . boot . autoconfigure . mongo . Mongo Properties Ċ import Ġorg . springframework . boot . context . properties . Enable Configuration Properties Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġorg . springframework . data . mongodb . config . Abstract Reactive Mongo Configuration Ċ Ċ @ Configuration Ċ @ Enable Configuration Properties ( Mongo Properties :: class ) Ċ class ĠMongoDB Config ( val Ġmongo Properties : ĠMongo Properties , Ġval Ġprofile Config : ĠProfile Config ) Ġ: ĠAbstract Reactive Mongo Configuration () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġmongo Client (): ĠMongo Client ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( profile Config . isActive ( Profiles . CLOUD )) ĠMongo Clients . create ( settings ()) ĊĠĠĠĠĠĠĠ Ġelse Ġif Ġ( profile Config . isActive ( Profiles . DOCKER )) ĠMongo Clients . create ( ConnectionString (" mongodb ://${ mongo Properties . host } ")) ĊĠĠĠĠĠĠĠ Ġelse ĠMongo Clients . create () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Database Name () Ġ= Ġmongo Properties . database ĊĊĠĠĠ Ġprivate Ġfun Ġsettings () Ġ= ĠMongo Client Settings . builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ssl Settings ( Ssl Settings . builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. enabled ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. cluster Settings ( cluster Settings ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. credential List ( listOf ( mongo Credentials ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. stream Factory Factory ( Net ty Stream Factory Factory . builder (). build ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġprivate Ġfun Ġcluster Settings () Ġ= ĠCluster Settings . builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. hosts ( listOf ( Server Address ( mongo Properties . host , Ġmongo Properties . port ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġprivate Ġfun Ġmongo Credentials () Ġ= ĠMongo Credential . create Mongo CR Credential ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmongo Properties . username , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmongo Properties . database , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmongo Properties . password ĊĠĠĠ Ġ) Ċ Ċ }