Skip to content

Commit

Permalink
Enable SSL in collector automatically if ENV var is present
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Feb 16, 2024
1 parent 155eebb commit f6d47b0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ object Configuration {
namespaced(ConfigFactory.load(namespaced(config.withFallback(namespaced(ConfigFactory.parseResources("collector-micro.conf"))))))

loadConfig[CollectorConfig[SinkConfig]](path, resolveOrder)
.map(adjustSslConfig)
}

def loadIgluResources(path: Option[Path]): EitherT[IO, String, IgluResources] = {
Expand Down Expand Up @@ -112,6 +113,10 @@ object Configuration {
client <- EitherT.liftF(IgluCirceClient.fromResolver[IO](completeResolver, resolverConfig.cacheSize))
} yield IgluResources(resolver, client)

private def adjustSslConfig(config: CollectorConfig[SinkConfig]): CollectorConfig[SinkConfig] = {
val envVarPresent = sys.env.contains(EnvironmentVariables.sslCertificatePassword)
config.copy(ssl = config.ssl.copy(enable = envVarPresent))
}

private def loadEnrichmentsAsSDD(enrichmentsDirectory: Path,
igluClient: IgluCirceClient[IO],
Expand Down

0 comments on commit f6d47b0

Please sign in to comment.