Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pshirshov committed Nov 16, 2023
1 parent cfed596 commit dcbbdc6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import izumi.distage.roles.RoleAppMain
import izumi.distage.roles.model.meta.RolesInfo
import izumi.fundamentals.platform.cli.model.raw.RawAppArgs

import java.io.File
import scala.annotation.nowarn

trait ConfigArgsProvider {
def args(): ConfigLoader.Args
}
Expand All @@ -13,11 +16,14 @@ object ConfigArgsProvider {
override def args(): ConfigLoader.Args = ConfigLoader.Args(None, Map.empty)
}

@nowarn("msg=Unused import")
class Default(
parameters: RawAppArgs,
rolesInfo: RolesInfo,
) extends ConfigArgsProvider {
override def args(): ConfigLoader.Args = {
import scala.collection.compat.*

val emptyRoleConfigs = rolesInfo.availableRoleNames.map(_ -> None).toMap

val maybeGlobalConfig = parameters.globalParameters.findValue(RoleAppMain.Options.configParam).asFile
Expand All @@ -26,7 +32,8 @@ object ConfigArgsProvider {
.toMap

// ConfigLoader.Args(maybeGlobalConfig, (emptyRoleConfigs ++ specifiedRoleConfigs).view.toMap)
ConfigLoader.Args(maybeGlobalConfig, (emptyRoleConfigs ++ specifiedRoleConfigs).view.filterKeys(rolesInfo.requiredRoleNames).toMap)
val allConfigs: Map[String, Option[File]] = emptyRoleConfigs ++ specifiedRoleConfigs
ConfigLoader.Args(maybeGlobalConfig, allConfigs.view.filterKeys(rolesInfo.requiredRoleNames).toMap)

}

Expand Down

0 comments on commit dcbbdc6

Please sign in to comment.