-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NU-1828] Processing types configs loader api (#7336)
- Loading branch information
Showing
35 changed files
with
505 additions
and
359 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
...-api/src/main/scala/pl/touk/nussknacker/ui/configloader/ProcessingTypeConfigsLoader.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 pl.touk.nussknacker.ui.configloader | ||
|
||
import cats.effect.IO | ||
import pl.touk.nussknacker.engine.ProcessingTypeConfig | ||
|
||
trait ProcessingTypeConfigsLoader { | ||
|
||
def loadProcessingTypeConfigs(): IO[ProcessingTypeConfigs] | ||
|
||
} | ||
|
||
case class ProcessingTypeConfigs(configByProcessingType: Map[String, ProcessingTypeConfig]) |
15 changes: 15 additions & 0 deletions
15
...c/main/scala/pl/touk/nussknacker/ui/configloader/ProcessingTypeConfigsLoaderFactory.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,15 @@ | ||
package pl.touk.nussknacker.ui.configloader | ||
|
||
import cats.effect.IO | ||
import cats.effect.unsafe.IORuntime | ||
import com.typesafe.config.Config | ||
import sttp.client3.SttpBackend | ||
|
||
trait ProcessingTypeConfigsLoaderFactory { | ||
|
||
def create( | ||
configLoaderConfig: Config, | ||
sttpBackend: SttpBackend[IO, Any], | ||
)(implicit ec: IORuntime): ProcessingTypeConfigsLoader | ||
|
||
} |
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
3 changes: 2 additions & 1 deletion
3
designer/server/src/main/scala/pl/touk/nussknacker/ui/NussknackerApp.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
31 changes: 0 additions & 31 deletions
31
designer/server/src/main/scala/pl/touk/nussknacker/ui/NussknackerConfig.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
34 changes: 34 additions & 0 deletions
34
designer/server/src/main/scala/pl/touk/nussknacker/ui/config/DesignerConfig.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,34 @@ | ||
package pl.touk.nussknacker.ui.config | ||
|
||
import com.typesafe.config.{Config, ConfigFactory} | ||
import pl.touk.nussknacker.engine.util.Implicits.RichScalaMap | ||
import pl.touk.nussknacker.engine.{ConfigWithUnresolvedVersion, ProcessingTypeConfig} | ||
import pl.touk.nussknacker.ui.configloader.ProcessingTypeConfigs | ||
|
||
// TODO: We should extract a class for all configuration options that should be available to designer instead of returning raw hocon config. | ||
// Thanks to that it will be easier to split processing type config from rest of configs and use this interface programmatically | ||
final case class DesignerConfig private (rawConfig: ConfigWithUnresolvedVersion) { | ||
|
||
import net.ceedubs.ficus.Ficus._ | ||
|
||
def processingTypeConfigs: ProcessingTypeConfigs = | ||
ProcessingTypeConfigs( | ||
rawConfig | ||
.readMap("scenarioTypes") | ||
.getOrElse { | ||
throw new RuntimeException("No scenario types configuration provided") | ||
} | ||
.mapValuesNow(ProcessingTypeConfig.read) | ||
) | ||
|
||
def configLoaderConfig: Config = rawConfig.resolved.getAs[Config]("configLoader").getOrElse(ConfigFactory.empty()) | ||
|
||
} | ||
|
||
object DesignerConfig { | ||
|
||
def from(config: Config): DesignerConfig = { | ||
DesignerConfig(ConfigWithUnresolvedVersion(config)) | ||
} | ||
|
||
} |
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
3 changes: 1 addition & 2 deletions
3
designer/server/src/main/scala/pl/touk/nussknacker/ui/db/entity/ProcessEntityFactory.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
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.