Optional YAML configuration for Brig#90
Conversation
| , types-common | ||
| , uri-bytestring | ||
|
|
||
| test-suite brig-integration |
There was a problem hiding this comment.
what's the motivation of changing the type here?
There was a problem hiding this comment.
test-suite implies running them as part of the build, which in the current code is worked around by requiring a certain environment variable. In reality, it is actually some sort of mix between a test and an executable.
This way, we should be able to build things (as before) without the need of a hack in the test executable.
There was a problem hiding this comment.
Okay. Please then also take out this hacky line in the Makefile: https://github.com/wireapp/wire-server/blob/develop/services/brig/Makefile#L31
services/brig/src/Brig/Options.hs
Outdated
| , port :: Word16 | ||
| } deriving (Show, Generic) | ||
|
|
||
| instance FromJSON Endpoint where |
There was a problem hiding this comment.
remove unnecessary trailing where keywords?
There was a problem hiding this comment.
yes, I just found out through hindent that they aren't required
services/brig/src/Brig/Options.hs
Outdated
| , setWhitelist :: !(Maybe Whitelist) | ||
| , setUserMaxConnections :: !Int64 | ||
| , setCookieDomain :: !ByteString | ||
| , setCookieDomain :: Text |
There was a problem hiding this comment.
Text -> !Text to ensure those are defined on startup?
services/brig/src/Brig/Whitelist.hs
Outdated
| , whitelistUser :: !ByteString | ||
| , whitelistPass :: !ByteString | ||
| } deriving Show | ||
| { whitelistReq :: !Text |
services/brig/src/Brig/ZAuth.hs
Outdated
| instance FromJSON UserTokenTimeout where | ||
| instance FromJSON SessionTokenTimeout where | ||
| instance FromJSON AccessTokenTimeout where | ||
| instance FromJSON ProviderTokenTimeout where |
| <> showDefault | ||
| <> value defaultPath | ||
| desc = header "Brig - User Service" <> fullDesc | ||
|
|
There was a problem hiding this comment.
instead of putting this into Main, perhaps move to one of the shared libraries? That would avoid duplication regarding other services & avoid having to add more dependencies to every build-deps in cabal files.
There was a problem hiding this comment.
I agree, is there an existing lib where this would fit?
There was a problem hiding this comment.
types-common would work I suppose.
|
|
||
| instance FromJSON Config where | ||
|
|
||
| tests :: Either ParseException Config -> Manager -> DB.ClientState -> Brig -> Cannon -> Galley -> IO TestTree |
There was a problem hiding this comment.
can we avoid passing a Either ParseException Config into every test? That failure arising from a missing configuration entry or missing ENV variable could be checked before starting any test. Would be better to handle this in Main.
There was a problem hiding this comment.
yes, that would have been preferable, but I don't see how this can be resolved in main since the environment vars are pulled directly in the tests.
Would Maybe Config help?
| . Cql.addContact h | ||
| main = withOpenSSL $ do | ||
| iConf <- decodeConfigFile "/etc/wire/brig/integration.yaml" | ||
| bConf <- decodeConfigFile "/etc/wire/brig/brig.yaml" |
There was a problem hiding this comment.
Can we make these locations configurable, please?
| <> showDefault | ||
| <> value defaultPath | ||
| desc = header "Brig - User Service" <> fullDesc | ||
|
|
There was a problem hiding this comment.
types-common would work I suppose.
4ca4fb9 to
2d62160
Compare
| import Options.Applicative | ||
| import System.Directory | ||
| import System.Environment (getArgs) | ||
| import System.IO (hPutStrLn, stderr) |
There was a problem hiding this comment.
Can we instead use our logger as, for instance, here which logs messages in a format that we can already parse?
There was a problem hiding this comment.
This is intended to be used before or without configuring the logging framework. This is basically a temporary workaround, until we decide for either options or config files. When we have one way to configure the app, we will simply terminate it with an error as before this PR.
I would rather remove "logging" from this file, as it is not really an error anyway.
There was a problem hiding this comment.
OK, let's leave it as-is then 👍
services/brig/Makefile
Outdated
| docker build -t $(executable) \ | ||
| -f ../../build/alpine/Dockerfile \ | ||
| -f Dockerfile \ | ||
| --build-arg service=$(NAME) \ |
There was a problem hiding this comment.
--build-arg service=$(NAME) \ can be removed.
dd1ce87 to
99c1934
Compare
|
@tiago-loureiro @jschaul, I did a rebase on develop and squashed. |
99c1934 to
2df5282
Compare
Adds optional YAML parsing for loading the configuration, the old commandline options are still supported. Only brig and brig-integration is implemented, brig-schema and brig-index needs to be done.