-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init org provider + project processor (#4742)
* Init org provider + project processor --------- Co-authored-by: Simon Dumas <[email protected]>
- Loading branch information
Showing
33 changed files
with
440 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/config/AppConfigError.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/config/Configs.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ch.epfl.bluebrain.nexus.delta.kernel.config | ||
|
||
import cats.effect.IO | ||
import com.typesafe.config.{Config, ConfigFactory, ConfigParseOptions, ConfigResolveOptions} | ||
import cats.syntax.all._ | ||
import pureconfig.error.ConfigReaderException | ||
import pureconfig.{ConfigReader, ConfigSource} | ||
|
||
import java.io.{File, Reader} | ||
|
||
object Configs { | ||
|
||
private val parseOptions = ConfigParseOptions.defaults().setAllowMissing(false) | ||
|
||
private val resolverOptions = ConfigResolveOptions.defaults() | ||
|
||
/** | ||
* Loads the config from the file or return an empty configuration | ||
*/ | ||
def parseFile(file: Option[File]): IO[Config] = | ||
IO.blocking(file.fold(ConfigFactory.empty()) { f => | ||
ConfigFactory.parseFile(f, parseOptions) | ||
}) | ||
|
||
/** | ||
* Loads the config from resource | ||
*/ | ||
def parseResource(resource: String): IO[Config] = | ||
IO.blocking(ConfigFactory.parseResources(resource, parseOptions)) | ||
|
||
/** | ||
* Loads the config from the reader | ||
*/ | ||
def parseReader(reader: Reader): IO[Config] = | ||
IO.blocking(ConfigFactory.parseReader(reader, parseOptions)) | ||
|
||
/** | ||
* Merge the configs in order and load the namespace according to the config reader | ||
*/ | ||
def merge[C: ConfigReader](namespace: String, configs: Config*): IO[(C, Config)] = IO.fromEither { | ||
val merged = configs | ||
.foldLeft(ConfigFactory.defaultOverrides())(_ withFallback _) | ||
.withFallback(ConfigFactory.load()) | ||
.resolve(resolverOptions) | ||
ConfigSource.fromConfig(merged).at(namespace).load[C].map(_ -> merged).leftMap(ConfigReaderException(_)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.