Not reading .thorp.conf file (#110)
* [core] ConfigurationBuilder read the correct source config file * [changelog] updated
This commit is contained in:
parent
775cba9cc0
commit
f2131ab7fc
3 changed files with 12 additions and 4 deletions
|
@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [[https://keepachangelog.com/en/1.0.0/][Keep a Changelog]], and this project adheres to
|
||||
[[https://semver.org/spec/v2.0.0.html][Semantic Versioning]].
|
||||
|
||||
|
||||
* [0.7.1] - 2019-07-13
|
||||
|
||||
** Fixed
|
||||
|
||||
- Not reading ~.thorp.conf~ file (#110)
|
||||
|
||||
* [0.7.0] - 2019-07-12
|
||||
|
||||
** Added
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.kemitix.thorp.domain.{Config, Sources}
|
|||
*/
|
||||
trait ConfigurationBuilder {
|
||||
|
||||
private val thorpConfigFileName = ".thorp.conf"
|
||||
|
||||
def buildConfig(priorityOptions: ConfigOptions): IO[Either[NonEmptyChain[ConfigValidation], Config]] = {
|
||||
val sources = ConfigQuery.sources(priorityOptions)
|
||||
|
@ -30,7 +31,7 @@ trait ConfigurationBuilder {
|
|||
private def sourceOptions(sources: Sources): IO[ConfigOptions] = {
|
||||
def existingThorpConfigFiles(sources: Sources) =
|
||||
sources.paths
|
||||
.map(_.resolve(".thorp.config"))
|
||||
.map(_.resolve(thorpConfigFileName))
|
||||
.filter(Files.exists(_))
|
||||
|
||||
def filterForSources: IO[ConfigOptions] => IO[(Sources, ConfigOptions)] =
|
||||
|
|
|
@ -10,7 +10,7 @@ class ConfigurationBuilderTest extends FunSpec with TemporaryFolder {
|
|||
private val pwd: Path = Paths.get(System.getenv("PWD"))
|
||||
private val aBucket = Bucket("aBucket")
|
||||
private val coBucket: ConfigOption.Bucket = ConfigOption.Bucket(aBucket.name)
|
||||
private val thorpConfigFileName = ".thorp.config"
|
||||
private val thorpConfigFileName = ".thorp.conf"
|
||||
|
||||
private def configOptions(options: ConfigOption*): ConfigOptions =
|
||||
ConfigOptions(List(
|
||||
|
@ -26,7 +26,7 @@ class ConfigurationBuilderTest extends FunSpec with TemporaryFolder {
|
|||
assertResult(expected)(result)
|
||||
}
|
||||
}
|
||||
describe("when has a single source with no .thorp.config") {
|
||||
describe("when has a single source with no .thorp.conf") {
|
||||
it("should only include the source once") {
|
||||
withDirectory(aSource => {
|
||||
val expected = Right(Sources(List(aSource)))
|
||||
|
@ -51,7 +51,7 @@ class ConfigurationBuilderTest extends FunSpec with TemporaryFolder {
|
|||
})
|
||||
}
|
||||
}
|
||||
describe("when current source has .thorp.config with source to another") {
|
||||
describe("when current source has .thorp.conf with source to another") {
|
||||
it("should include both sources in order") {
|
||||
withDirectory(currentSource => {
|
||||
withDirectory(previousSource => {
|
||||
|
|
Loading…
Reference in a new issue