Skip to content

Commit

Permalink
fixed besom-cfg usage of Context
Browse files Browse the repository at this point in the history
  • Loading branch information
lbialy committed Sep 20, 2024
1 parent baccd28 commit e0eacb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions besom-cfg/k8s/src/main/scala/ConfiguredContainerArgs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import besom.cfg.k8s.syntax.*

object syntax:
extension (s: Struct)
def foldedToEnvVarArgs(using Context): Output[List[EnvVarArgs]] =
def foldedToEnvVarArgs: Output[List[EnvVarArgs]] =
s.foldToEnv.map(_.map { case (k, v) => EnvVarArgs(name = k, value = v) })

object ConfiguredContainerArgs:
Expand Down Expand Up @@ -132,7 +132,8 @@ object ConfiguredContainerArgs:
val envExpr = '{
val envOutput = ${ env }.asOptionOutput()
val conf = ${ configuration }
val configurationAsEnvVarArgs = conf.foldedToEnvVarArgs(using $context)
val configurationAsEnvVarArgs = conf.foldedToEnvVarArgs

envOutput.zip(configurationAsEnvVarArgs).map {
case (Some(envVarArgsList), envVarArgsListFromConf) => envVarArgsList ++ envVarArgsListFromConf
case (None, envVarArgsListFromConf) => envVarArgsListFromConf
Expand Down Expand Up @@ -165,7 +166,7 @@ object ConfiguredContainerArgs:
volumeDevices = $volumeDevices,
volumeMounts = $volumeMounts,
workingDir = $workingDir
)(using $context)
)
}
end match
end applyImpl
Expand Down
4 changes: 2 additions & 2 deletions besom-cfg/lib/src/main/scala/Struct.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Struct private (val _values: ListMap[String, Any]) extends Selectable:
onStruct: Map[String, Output[B]] => Output[B],
onList: List[B] => Output[B],
onValue: Any => Output[B]
)(using Context): Output[B] =
): Output[B] =
val onOutput: Output[_] => Output[B] = _.flatMap {
case s: Struct => s.fold(onStruct, onList, onValue)
case a => onValue(a)
Expand Down Expand Up @@ -91,7 +91,7 @@ object Struct extends Dynamic:
)

extension (s: Struct)
def foldToEnv(using Context): Output[List[(String, String)]] = s.fold[List[(String, String)]](
def foldToEnv: Output[List[(String, String)]] = s.fold[List[(String, String)]](
onStruct = { mapB =>
mapB.foldLeft(Output(List.empty[(String, String)])) { case (acc, (k, v)) =>
acc.flatMap { accList =>
Expand Down

0 comments on commit e0eacb2

Please sign in to comment.