From f2131ab7fc5ab6380c5ab62c7f3944b1c8ce92da Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 13 Jul 2019 15:43:40 +0100 Subject: [PATCH] Not reading .thorp.conf file (#110) * [core] ConfigurationBuilder read the correct source config file * [changelog] updated --- CHANGELOG.org | 7 +++++++ .../net/kemitix/thorp/core/ConfigurationBuilder.scala | 3 ++- .../net/kemitix/thorp/core/ConfigurationBuilderTest.scala | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index f941775..2d1a953 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -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 diff --git a/core/src/main/scala/net/kemitix/thorp/core/ConfigurationBuilder.scala b/core/src/main/scala/net/kemitix/thorp/core/ConfigurationBuilder.scala index 05851cd..1be68b0 100644 --- a/core/src/main/scala/net/kemitix/thorp/core/ConfigurationBuilder.scala +++ b/core/src/main/scala/net/kemitix/thorp/core/ConfigurationBuilder.scala @@ -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)] = diff --git a/core/src/test/scala/net/kemitix/thorp/core/ConfigurationBuilderTest.scala b/core/src/test/scala/net/kemitix/thorp/core/ConfigurationBuilderTest.scala index 2f36551..af41bd3 100644 --- a/core/src/test/scala/net/kemitix/thorp/core/ConfigurationBuilderTest.scala +++ b/core/src/test/scala/net/kemitix/thorp/core/ConfigurationBuilderTest.scala @@ -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 => {