module Testlib.ResourcePool
( ResourcePool,
BackendResource (..),
DynamicBackendConfig (..),
resourceServiceMap,
backendResources,
createBackendResourcePool,
acquireResources,
backendA,
backendB,
)
where
import Control.Concurrent
import Control.Monad.Catch
import Control.Monad.Codensity
import Control.Monad.IO.Class
import Data.Aeson
import Data.Foldable (for_)
import Data.Functor
import Data.IORef
import qualified Data.Set as Set
import Data.String
import qualified Data.Text as T
import Data.Tuple
import Database.CQL.IO
import GHC.Stack (HasCallStack)
import Network.AMQP.Extended
import Network.RabbitMqAdmin
import System.IO
import qualified Testlib.Ports as Ports
import Testlib.Types
import Prelude
resourceServiceMap :: BackendResource -> ServiceMap
resourceServiceMap :: BackendResource -> ServiceMap
resourceServiceMap BackendResource
resource =
let g :: Service -> HostPort
g Service
srv = String -> Word16 -> HostPort
HostPort String
"127.0.0.1" (BackendResource -> forall a. Num a => Service -> a
berInternalServicePorts BackendResource
resource Service
srv)
in ServiceMap
{ $sel:brig:ServiceMap :: HostPort
brig = Service -> HostPort
g Service
Brig,
$sel:backgroundWorker:ServiceMap :: HostPort
backgroundWorker = Service -> HostPort
g Service
BackgroundWorker,
$sel:cannon:ServiceMap :: HostPort
cannon = Service -> HostPort
g Service
Cannon,
$sel:cargohold:ServiceMap :: HostPort
cargohold = Service -> HostPort
g Service
Cargohold,
$sel:federatorInternal:ServiceMap :: HostPort
federatorInternal = Service -> HostPort
g Service
FederatorInternal,
$sel:federatorExternal:ServiceMap :: HostPort
federatorExternal = String -> Word16 -> HostPort
HostPort String
"127.0.0.1" BackendResource
resource.berFederatorExternal,
$sel:galley:ServiceMap :: HostPort
galley = Service -> HostPort
g Service
Galley,
$sel:gundeck:ServiceMap :: HostPort
gundeck = Service -> HostPort
g Service
Gundeck,
$sel:nginz:ServiceMap :: HostPort
nginz = Service -> HostPort
g Service
Nginz,
$sel:spar:ServiceMap :: HostPort
spar = Service -> HostPort
g Service
Spar,
$sel:proxy:ServiceMap :: HostPort
proxy = String -> Word16 -> HostPort
HostPort String
"127.0.0.1" Word16
9087,
$sel:stern:ServiceMap :: HostPort
stern = Service -> HostPort
g Service
Stern
}
acquireResources :: forall m a. (Ord a, MonadIO m, MonadMask m, HasCallStack) => Int -> ResourcePool a -> Codensity m [a]
acquireResources :: forall (m :: * -> *) a.
(Ord a, MonadIO m, MonadMask m, HasCallStack) =>
Int -> ResourcePool a -> Codensity m [a]
acquireResources Int
n ResourcePool a
pool = (forall b. ([a] -> m b) -> m b) -> Codensity m [a]
forall k (m :: k -> *) a.
(forall (b :: k). (a -> m b) -> m b) -> Codensity m a
Codensity ((forall b. ([a] -> m b) -> m b) -> Codensity m [a])
-> (forall b. ([a] -> m b) -> m b) -> Codensity m [a]
forall a b. (a -> b) -> a -> b
$ \[a] -> m b
f -> m (Set a) -> (Set a -> m ()) -> (Set a -> m b) -> m b
forall (m :: * -> *) a c b.
(HasCallStack, MonadMask m) =>
m a -> (a -> m c) -> (a -> m b) -> m b
bracket m (Set a)
acquire Set a -> m ()
release ((Set a -> m b) -> m b) -> (Set a -> m b) -> m b
forall a b. (a -> b) -> a -> b
$ \Set a
s -> do
IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ (a -> IO ()) -> Set a -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ResourcePool a
pool.onAcquire Set a
s
[a] -> m b
f ([a] -> m b) -> [a] -> m b
forall a b. (a -> b) -> a -> b
$ Set a -> [a]
forall a. Set a -> [a]
Set.toList Set a
s
where
release :: Set.Set a -> m ()
release :: Set a -> m ()
release Set a
s =
IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
IORef (Set a) -> (Set a -> (Set a, ())) -> IO ()
forall a b. IORef a -> (a -> (a, b)) -> IO b
atomicModifyIORef ResourcePool a
pool.resources ((Set a -> (Set a, ())) -> IO ())
-> (Set a -> (Set a, ())) -> IO ()
forall a b. (a -> b) -> a -> b
$ (,()) (Set a -> (Set a, ())) -> (Set a -> Set a) -> Set a -> (Set a, ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set a -> Set a -> Set a
forall a. Ord a => Set a -> Set a -> Set a
Set.union Set a
s
QSemN -> Int -> IO ()
signalQSemN ResourcePool a
pool.sem (Set a -> Int
forall a. Set a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Set a
s)
acquire :: m (Set.Set a)
acquire :: m (Set a)
acquire = IO (Set a) -> m (Set a)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Set a) -> m (Set a)) -> IO (Set a) -> m (Set a)
forall a b. (a -> b) -> a -> b
$ do
QSemN -> Int -> IO ()
waitQSemN ResourcePool a
pool.sem Int
n
IORef (Set a) -> (Set a -> (Set a, Set a)) -> IO (Set a)
forall a b. IORef a -> (a -> (a, b)) -> IO b
atomicModifyIORef ResourcePool a
pool.resources ((Set a -> (Set a, Set a)) -> IO (Set a))
-> (Set a -> (Set a, Set a)) -> IO (Set a)
forall a b. (a -> b) -> a -> b
$ (Set a, Set a) -> (Set a, Set a)
forall a b. (a, b) -> (b, a)
swap ((Set a, Set a) -> (Set a, Set a))
-> (Set a -> (Set a, Set a)) -> Set a -> (Set a, Set a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Set a -> (Set a, Set a)
forall a. Int -> Set a -> (Set a, Set a)
Set.splitAt Int
n
createBackendResourcePool :: [BackendResource] -> RabbitMQConfig -> ClientState -> IO (ResourcePool BackendResource)
createBackendResourcePool :: [BackendResource]
-> RabbitMQConfig
-> ClientState
-> IO (ResourcePool BackendResource)
createBackendResourcePool [BackendResource]
resources RabbitMQConfig
rabbitmq ClientState
cassClient =
let cleanupBackend :: BackendResource -> IO ()
cleanupBackend :: BackendResource -> IO ()
cleanupBackend BackendResource
resource = do
RabbitMQConfig -> BackendResource -> IO ()
deleteAllRabbitMQQueues RabbitMQConfig
rabbitmq BackendResource
resource
ClientState -> Client () -> IO ()
forall (m :: * -> *) a. MonadIO m => ClientState -> Client a -> m a
runClient ClientState
cassClient (Client () -> IO ()) -> Client () -> IO ()
forall a b. (a -> b) -> a -> b
$ BackendResource -> Client ()
deleteAllDynamicBackendConfigs BackendResource
resource
in QSemN
-> IORef (Set BackendResource)
-> (BackendResource -> IO ())
-> ResourcePool BackendResource
forall a. QSemN -> IORef (Set a) -> (a -> IO ()) -> ResourcePool a
ResourcePool
(QSemN
-> IORef (Set BackendResource)
-> (BackendResource -> IO ())
-> ResourcePool BackendResource)
-> IO QSemN
-> IO
(IORef (Set BackendResource)
-> (BackendResource -> IO ()) -> ResourcePool BackendResource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> IO QSemN
newQSemN ([BackendResource] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [BackendResource]
resources)
IO
(IORef (Set BackendResource)
-> (BackendResource -> IO ()) -> ResourcePool BackendResource)
-> IO (IORef (Set BackendResource))
-> IO ((BackendResource -> IO ()) -> ResourcePool BackendResource)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Set BackendResource -> IO (IORef (Set BackendResource))
forall a. a -> IO (IORef a)
newIORef ([BackendResource] -> Set BackendResource
forall a. Ord a => [a] -> Set a
Set.fromList [BackendResource]
resources)
IO ((BackendResource -> IO ()) -> ResourcePool BackendResource)
-> IO (BackendResource -> IO ())
-> IO (ResourcePool BackendResource)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (BackendResource -> IO ()) -> IO (BackendResource -> IO ())
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure BackendResource -> IO ()
cleanupBackend
deleteAllRabbitMQQueues :: RabbitMQConfig -> BackendResource -> IO ()
deleteAllRabbitMQQueues :: RabbitMQConfig -> BackendResource -> IO ()
deleteAllRabbitMQQueues RabbitMQConfig
rc BackendResource
resource = do
let opts :: RabbitMqAdminOpts
opts =
RabbitMqAdminOpts
{ $sel:host:RabbitMqAdminOpts :: String
host = RabbitMQConfig
rc.host,
$sel:port:RabbitMqAdminOpts :: Int
port = Int
0,
$sel:adminPort:RabbitMqAdminOpts :: Int
adminPort = Word16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral RabbitMQConfig
rc.adminPort,
$sel:vHost:RabbitMqAdminOpts :: Text
vHost = String -> Text
T.pack BackendResource
resource.berVHost,
$sel:tls:RabbitMqAdminOpts :: Maybe RabbitMqTlsOpts
tls = RabbitMqTlsOpts -> Maybe RabbitMqTlsOpts
forall a. a -> Maybe a
Just (RabbitMqTlsOpts -> Maybe RabbitMqTlsOpts)
-> RabbitMqTlsOpts -> Maybe RabbitMqTlsOpts
forall a b. (a -> b) -> a -> b
$ Maybe String -> Bool -> RabbitMqTlsOpts
RabbitMqTlsOpts Maybe String
forall a. Maybe a
Nothing Bool
True
}
AdminAPI (AsClientT IO)
client <- RabbitMqAdminOpts -> IO (AdminAPI (AsClientT IO))
mkRabbitMqAdminClientEnv RabbitMqAdminOpts
opts
[Queue]
queues <- AdminAPI (AsClientT IO)
-> AsClientT IO
:- ("api"
:> ("queues" :> (Capture "vhost" Text :> Get '[JSON] [Queue])))
forall route.
AdminAPI route
-> route
:- ("api"
:> ("queues" :> (Capture "vhost" Text :> Get '[JSON] [Queue])))
listQueuesByVHost AdminAPI (AsClientT IO)
client (String -> Text
T.pack BackendResource
resource.berVHost)
[Queue] -> (Queue -> IO NoContent) -> IO ()
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
t a -> (a -> f b) -> f ()
for_ [Queue]
queues ((Queue -> IO NoContent) -> IO ())
-> (Queue -> IO NoContent) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Queue
queue ->
AdminAPI (AsClientT IO)
-> AsClientT IO
:- ("api"
:> ("queues"
:> (Capture "vhost" Text
:> (Capture "queue" Text :> DeleteNoContent))))
forall route.
AdminAPI route
-> route
:- ("api"
:> ("queues"
:> (Capture "vhost" Text
:> (Capture "queue" Text :> DeleteNoContent))))
deleteQueue AdminAPI (AsClientT IO)
client (String -> Text
T.pack BackendResource
resource.berVHost) Queue
queue.name
deleteAllDynamicBackendConfigs :: BackendResource -> Client ()
deleteAllDynamicBackendConfigs :: BackendResource -> Client ()
deleteAllDynamicBackendConfigs BackendResource
resource = PrepQuery W () () -> QueryParams () -> Client ()
forall (m :: * -> *) a (q :: * -> * -> * -> *).
(MonadClient m, Tuple a, RunQ q) =>
q W a () -> QueryParams a -> m ()
write PrepQuery W () ()
cql (Consistency -> () -> QueryParams ()
forall a. Consistency -> a -> QueryParams a
defQueryParams Consistency
LocalQuorum ())
where
cql :: PrepQuery W () ()
cql :: PrepQuery W () ()
cql = String -> PrepQuery W () ()
forall a. IsString a => String -> a
fromString (String -> PrepQuery W () ()) -> String -> PrepQuery W () ()
forall a b. (a -> b) -> a -> b
$ String
"TRUNCATE " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> BackendResource
resource.berBrigKeyspace String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
".federation_remotes"
backendResources :: [DynamicBackendConfig] -> [BackendResource]
backendResources :: [DynamicBackendConfig] -> [BackendResource]
backendResources [DynamicBackendConfig]
dynConfs =
([DynamicBackendConfig] -> [Int] -> [(DynamicBackendConfig, Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [DynamicBackendConfig]
dynConfs [Int
1 ..])
[(DynamicBackendConfig, Int)]
-> ((DynamicBackendConfig, Int) -> BackendResource)
-> [BackendResource]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> ( \(DynamicBackendConfig
dynConf, Int
i) ->
let name :: BackendName
name = Int -> BackendName
DynamicBackend Int
i
in BackendResource
{ $sel:berName:BackendResource :: BackendName
berName = BackendName
name,
$sel:berBrigKeyspace:BackendResource :: String
berBrigKeyspace = String
"brig_test_dyn_" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
i,
$sel:berGalleyKeyspace:BackendResource :: String
berGalleyKeyspace = String
"galley_test_dyn_" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
i,
$sel:berSparKeyspace:BackendResource :: String
berSparKeyspace = String
"spar_test_dyn_" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
i,
$sel:berGundeckKeyspace:BackendResource :: String
berGundeckKeyspace = String
"gundeck_test_dyn_" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
i,
$sel:berElasticsearchIndex:BackendResource :: String
berElasticsearchIndex = String
"directory_dyn_" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
i String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"_test",
$sel:berFederatorInternal:BackendResource :: Word16
berFederatorInternal = PortNamespace -> Int -> Word16
forall a. Num a => PortNamespace -> Int -> a
Ports.portForDyn (Service -> PortNamespace
Ports.ServiceInternal Service
FederatorInternal) Int
i,
$sel:berFederatorExternal:BackendResource :: Word16
berFederatorExternal = DynamicBackendConfig
dynConf.federatorExternalPort,
$sel:berDomain:BackendResource :: String
berDomain = DynamicBackendConfig
dynConf.domain,
$sel:berAwsUserJournalQueue:BackendResource :: String
berAwsUserJournalQueue = String
"integration-user-events" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
".fifo",
$sel:berAwsPrekeyTable:BackendResource :: String
berAwsPrekeyTable = String
"integration-brig-prekeys" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i,
$sel:berAwsS3Bucket:BackendResource :: String
berAwsS3Bucket = String
"dummy-bucket" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i,
$sel:berAwsQueueName:BackendResource :: String
berAwsQueueName = String
"integration-gundeck-events" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i,
$sel:berBrigInternalEvents:BackendResource :: String
berBrigInternalEvents = String
"integration-brig-events-internal" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i,
$sel:berEmailSMSSesQueue:BackendResource :: String
berEmailSMSSesQueue = String
"integration-brig-events" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i,
$sel:berEmailSMSEmailSender:BackendResource :: String
berEmailSMSEmailSender = String
"backend-integration" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"@wire.com",
$sel:berGalleyJournal:BackendResource :: String
berGalleyJournal = String
"integration-team-events" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. (Show a, Num a) => a -> String
suffix Int
i String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
".fifo",
$sel:berVHost:BackendResource :: String
berVHost = DynamicBackendConfig
dynConf.domain,
$sel:berNginzSslPort:BackendResource :: Word16
berNginzSslPort = PortNamespace -> Int -> Word16
forall a. Num a => PortNamespace -> Int -> a
Ports.portForDyn PortNamespace
Ports.NginzSSL Int
i,
$sel:berNginzHttp2Port:BackendResource :: Word16
berNginzHttp2Port = PortNamespace -> Int -> Word16
forall a. Num a => PortNamespace -> Int -> a
Ports.portForDyn PortNamespace
Ports.NginzHttp2 Int
i,
$sel:berInternalServicePorts:BackendResource :: forall a. Num a => Service -> a
berInternalServicePorts = BackendName -> Service -> a
forall a. Num a => BackendName -> Service -> a
Ports.internalServicePorts BackendName
name,
$sel:berMlsPrivateKeyPaths:BackendResource :: Value
berMlsPrivateKeyPaths = DynamicBackendConfig
dynConf.mlsPrivateKeyPaths
}
)
where
suffix :: (Show a, Num a) => a -> String
suffix :: forall a. (Show a, Num a) => a -> String
suffix a
i = a -> String
forall a. Show a => a -> String
show (a -> String) -> a -> String
forall a b. (a -> b) -> a -> b
$ a
i a -> a -> a
forall a. Num a => a -> a -> a
+ a
2
backendA :: BackendResource
backendA :: BackendResource
backendA =
BackendResource
{ $sel:berName:BackendResource :: BackendName
berName = BackendName
BackendA,
$sel:berBrigKeyspace:BackendResource :: String
berBrigKeyspace = String
"brig_test",
$sel:berGalleyKeyspace:BackendResource :: String
berGalleyKeyspace = String
"galley_test",
$sel:berSparKeyspace:BackendResource :: String
berSparKeyspace = String
"spar_test",
$sel:berGundeckKeyspace:BackendResource :: String
berGundeckKeyspace = String
"gundeck_test",
$sel:berElasticsearchIndex:BackendResource :: String
berElasticsearchIndex = String
"directory_test",
$sel:berFederatorInternal:BackendResource :: Word16
berFederatorInternal = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port (Service -> PortNamespace
Ports.ServiceInternal Service
FederatorInternal) BackendName
BackendA,
$sel:berFederatorExternal:BackendResource :: Word16
berFederatorExternal = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port PortNamespace
Ports.FederatorExternal BackendName
BackendA,
$sel:berDomain:BackendResource :: String
berDomain = String
"example.com",
$sel:berAwsUserJournalQueue:BackendResource :: String
berAwsUserJournalQueue = String
"integration-user-events.fifo",
$sel:berAwsPrekeyTable:BackendResource :: String
berAwsPrekeyTable = String
"integration-brig-prekeys",
$sel:berAwsS3Bucket:BackendResource :: String
berAwsS3Bucket = String
"dummy-bucket",
$sel:berAwsQueueName:BackendResource :: String
berAwsQueueName = String
"integration-gundeck-events",
$sel:berBrigInternalEvents:BackendResource :: String
berBrigInternalEvents = String
"integration-brig-events-internal",
$sel:berEmailSMSSesQueue:BackendResource :: String
berEmailSMSSesQueue = String
"integration-brig-events",
$sel:berEmailSMSEmailSender:BackendResource :: String
berEmailSMSEmailSender = String
"backend-integration@wire.com",
$sel:berGalleyJournal:BackendResource :: String
berGalleyJournal = String
"integration-team-events.fifo",
$sel:berVHost:BackendResource :: String
berVHost = String
"backendA",
$sel:berNginzSslPort:BackendResource :: Word16
berNginzSslPort = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port PortNamespace
Ports.NginzSSL BackendName
BackendA,
$sel:berInternalServicePorts:BackendResource :: forall a. Num a => Service -> a
berInternalServicePorts = BackendName -> Service -> a
forall a. Num a => BackendName -> Service -> a
Ports.internalServicePorts BackendName
BackendA,
$sel:berNginzHttp2Port:BackendResource :: Word16
berNginzHttp2Port = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port PortNamespace
Ports.NginzHttp2 BackendName
BackendA,
$sel:berMlsPrivateKeyPaths:BackendResource :: Value
berMlsPrivateKeyPaths =
[Pair] -> Value
object
[ String -> Key
forall a. IsString a => String -> a
fromString String
"removal"
Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= [Pair] -> Value
object
[ String -> Key
forall a. IsString a => String -> a
fromString String
"ed25519" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendA/ed25519.pem",
String -> Key
forall a. IsString a => String -> a
fromString String
"ecdsa_secp256r1_sha256" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendA/ecdsa_secp256r1_sha256.pem",
String -> Key
forall a. IsString a => String -> a
fromString String
"ecdsa_secp384r1_sha384" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendA/ecdsa_secp384r1_sha384.pem",
String -> Key
forall a. IsString a => String -> a
fromString String
"ecdsa_secp521r1_sha512" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendA/ecdsa_secp521r1_sha512.pem"
]
]
}
backendB :: BackendResource
backendB :: BackendResource
backendB =
BackendResource
{ $sel:berName:BackendResource :: BackendName
berName = BackendName
BackendB,
$sel:berBrigKeyspace:BackendResource :: String
berBrigKeyspace = String
"brig_test2",
$sel:berGalleyKeyspace:BackendResource :: String
berGalleyKeyspace = String
"galley_test2",
$sel:berSparKeyspace:BackendResource :: String
berSparKeyspace = String
"spar_test2",
$sel:berGundeckKeyspace:BackendResource :: String
berGundeckKeyspace = String
"gundeck_test2",
$sel:berElasticsearchIndex:BackendResource :: String
berElasticsearchIndex = String
"directory2_test",
$sel:berFederatorInternal:BackendResource :: Word16
berFederatorInternal = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port (Service -> PortNamespace
Ports.ServiceInternal Service
FederatorInternal) BackendName
BackendB,
$sel:berFederatorExternal:BackendResource :: Word16
berFederatorExternal = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port PortNamespace
Ports.FederatorExternal BackendName
BackendB,
$sel:berDomain:BackendResource :: String
berDomain = String
"b.example.com",
$sel:berAwsUserJournalQueue:BackendResource :: String
berAwsUserJournalQueue = String
"integration-user-events2.fifo",
$sel:berAwsPrekeyTable:BackendResource :: String
berAwsPrekeyTable = String
"integration-brig-prekeys2",
$sel:berAwsS3Bucket:BackendResource :: String
berAwsS3Bucket = String
"dummy-bucket2",
$sel:berAwsQueueName:BackendResource :: String
berAwsQueueName = String
"integration-gundeck-events2",
$sel:berBrigInternalEvents:BackendResource :: String
berBrigInternalEvents = String
"integration-brig-events-internal2",
$sel:berEmailSMSSesQueue:BackendResource :: String
berEmailSMSSesQueue = String
"integration-brig-events2",
$sel:berEmailSMSEmailSender:BackendResource :: String
berEmailSMSEmailSender = String
"backend-integration2@wire.com",
$sel:berGalleyJournal:BackendResource :: String
berGalleyJournal = String
"integration-team-events2.fifo",
$sel:berVHost:BackendResource :: String
berVHost = String
"backendB",
$sel:berNginzSslPort:BackendResource :: Word16
berNginzSslPort = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port PortNamespace
Ports.NginzSSL BackendName
BackendB,
$sel:berInternalServicePorts:BackendResource :: forall a. Num a => Service -> a
berInternalServicePorts = BackendName -> Service -> a
forall a. Num a => BackendName -> Service -> a
Ports.internalServicePorts BackendName
BackendB,
$sel:berNginzHttp2Port:BackendResource :: Word16
berNginzHttp2Port = PortNamespace -> BackendName -> Word16
forall a. Num a => PortNamespace -> BackendName -> a
Ports.port PortNamespace
Ports.NginzHttp2 BackendName
BackendB,
$sel:berMlsPrivateKeyPaths:BackendResource :: Value
berMlsPrivateKeyPaths =
[Pair] -> Value
object
[ String -> Key
forall a. IsString a => String -> a
fromString String
"removal"
Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= [Pair] -> Value
object
[ String -> Key
forall a. IsString a => String -> a
fromString String
"ed25519" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendB/ed25519.pem",
String -> Key
forall a. IsString a => String -> a
fromString String
"ecdsa_secp256r1_sha256" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendB/ecdsa_secp256r1_sha256.pem",
String -> Key
forall a. IsString a => String -> a
fromString String
"ecdsa_secp384r1_sha384" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendB/ecdsa_secp384r1_sha384.pem",
String -> Key
forall a. IsString a => String -> a
fromString String
"ecdsa_secp521r1_sha512" Key -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= String
"test/resources/backendB/ecdsa_secp521r1_sha512.pem"
]
]
}