-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: individual configs retained in appconfig, TODO: rewrite ConfigWr…
…iter
- Loading branch information
Showing
18 changed files
with
302 additions
and
165 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...ge/distage-extension-config/.js/src/main/scala/izumi/distage/config/model/AppConfig.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,12 @@ | ||
package izumi.distage.config.model | ||
|
||
import izumi.distage.config.DistageConfigImpl | ||
|
||
final case class AppConfig( | ||
config: DistageConfigImpl | ||
) | ||
|
||
object AppConfig { | ||
val empty: AppConfig = AppConfig(Map.empty[String, String]) | ||
def provided(config: DistageConfigImpl): AppConfig = AppConfig(config) | ||
} |
5 changes: 0 additions & 5 deletions
5
...tage-extension-config/.js/src/main/scala/izumi/distage/config/model/AppConfigSyntax.scala
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
...e/distage-extension-config/.jvm/src/main/scala/izumi/distage/config/model/AppConfig.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,67 @@ | ||
package izumi.distage.config.model | ||
|
||
import com.typesafe.config.{Config, ConfigFactory} | ||
import izumi.distage.config.DistageConfigImpl | ||
|
||
import java.io.File | ||
|
||
final case class AppConfig( | ||
config: DistageConfigImpl, | ||
shared: List[ConfigLoadResult.Success], | ||
roles: List[LoadedRoleConfigs], | ||
) | ||
|
||
object AppConfig { | ||
val empty: AppConfig = AppConfig(ConfigFactory.empty(), List.empty, List.empty) | ||
def provided(config: DistageConfigImpl): AppConfig = AppConfig(config, List.empty, List.empty) | ||
} | ||
|
||
sealed trait GenericConfigSource | ||
|
||
object GenericConfigSource { | ||
case class ConfigFile(file: File) extends GenericConfigSource | ||
|
||
case object ConfigDefault extends GenericConfigSource | ||
} | ||
|
||
case class RoleConfig(role: String, active: Boolean, configSource: GenericConfigSource) | ||
|
||
case class LoadedRoleConfigs(roleConfig: RoleConfig, loaded: Seq[ConfigLoadResult.Success]) | ||
|
||
sealed trait ConfigLoadResult { | ||
def clue: String | ||
|
||
def src: ConfigSource | ||
|
||
def toEither: Either[ConfigLoadResult.Failure, ConfigLoadResult.Success] | ||
} | ||
|
||
object ConfigLoadResult { | ||
case class Success(clue: String, src: ConfigSource, config: Config) extends ConfigLoadResult { | ||
override def toEither: Either[ConfigLoadResult.Failure, ConfigLoadResult.Success] = Right(this) | ||
} | ||
|
||
case class Failure(clue: String, src: ConfigSource, failure: Throwable) extends ConfigLoadResult { | ||
override def toEither: Either[ConfigLoadResult.Failure, ConfigLoadResult.Success] = Left(this) | ||
} | ||
} | ||
|
||
sealed trait ConfigSource | ||
|
||
object ConfigSource { | ||
final case class Resource(name: String, kind: ResourceConfigKind) extends ConfigSource { | ||
override def toString: String = s"resource:$name" | ||
} | ||
|
||
final case class File(file: java.io.File) extends ConfigSource { | ||
override def toString: String = s"file:$file" | ||
} | ||
} | ||
|
||
sealed trait ResourceConfigKind | ||
|
||
object ResourceConfigKind { | ||
case object Primary extends ResourceConfigKind | ||
|
||
case object Development extends ResourceConfigKind | ||
} |
7 changes: 0 additions & 7 deletions
7
...age-extension-config/.jvm/src/main/scala/izumi/distage/config/model/AppConfigSyntax.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
7 changes: 0 additions & 7 deletions
7
distage/distage-extension-config/src/main/scala/izumi/distage/config/model/AppConfig.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
Oops, something went wrong.