diff --git a/core/pom.xml b/core/pom.xml
index a39e505e..2f2debd9 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -43,14 +43,6 @@
org.bouncycastle
bcpkix-jdk18on
-
- dev.streamx
- streamx-runner
-
-
- dev.streamx
- streamx-operator-mesh-api
-
com.fasterxml.jackson.datatype
jackson-datatype-jdk8
@@ -67,6 +59,11 @@
commons-codec
commons-codec
+
+ org.jetbrains
+ annotations
+ 26.0.2-1
+
com.jayway.jsonpath
json-path
@@ -119,6 +116,31 @@
kubernetes-httpclient-okhttp
test
+
+ org.testcontainers
+ testcontainers-bom
+ 2.0.2
+ pom
+ import
+
+
+ org.apache.commons
+ commons-lang3
+ 3.20.0
+ compile
+
+
+ com.google.guava
+ guava
+ 33.5.0-jre
+ compile
+
+
+ org.bouncycastle
+ bcprov-jdk18on
+ 1.83
+ compile
+
diff --git a/core/src/main/java/dev/streamx/cli/BannerPrinter.java b/core/src/main/java/dev/streamx/cli/BannerPrinter.java
index ee98e3c7..91a17053 100644
--- a/core/src/main/java/dev/streamx/cli/BannerPrinter.java
+++ b/core/src/main/java/dev/streamx/cli/BannerPrinter.java
@@ -2,8 +2,6 @@
import static dev.streamx.cli.util.Output.print;
-import dev.streamx.cli.command.dev.DevCommand;
-import dev.streamx.cli.command.run.RunCommand;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.Set;
import picocli.CommandLine;
@@ -13,7 +11,7 @@
public class BannerPrinter {
private static final Set COMMANDS_REQUIRING_PRINTING_BANNER =
- Set.of(DevCommand.COMMAND_NAME, RunCommand.COMMAND_NAME);
+ Set.of();
private static final String BANNER = """
____ _ __ __
diff --git a/core/src/main/java/dev/streamx/cli/StreamxCommand.java b/core/src/main/java/dev/streamx/cli/StreamxCommand.java
index c16b95aa..4cb6132f 100644
--- a/core/src/main/java/dev/streamx/cli/StreamxCommand.java
+++ b/core/src/main/java/dev/streamx/cli/StreamxCommand.java
@@ -1,14 +1,10 @@
package dev.streamx.cli;
-import dev.streamx.cli.command.cloud.deploy.DeployCommand;
-import dev.streamx.cli.command.cloud.undeploy.UndeployCommand;
-import dev.streamx.cli.command.dev.DevCommand;
import dev.streamx.cli.command.ingestion.batch.BatchCommand;
import dev.streamx.cli.command.ingestion.publish.PublishCommand;
import dev.streamx.cli.command.ingestion.stream.StreamCommand;
import dev.streamx.cli.command.ingestion.unpublish.UnpublishCommand;
import dev.streamx.cli.command.init.InitCommand;
-import dev.streamx.cli.command.run.RunCommand;
import dev.streamx.cli.config.ArgumentConfigSource;
import dev.streamx.cli.config.validation.ConfigSourcesValidator;
import dev.streamx.cli.license.LicenseArguments;
@@ -31,10 +27,8 @@
name = "streamx",
subcommands = {
InitCommand.class,
- RunCommand.class, DevCommand.class,
PublishCommand.class, UnpublishCommand.class,
BatchCommand.class, StreamCommand.class,
- DeployCommand.class, UndeployCommand.class,
HelpCommand.class
},
versionProvider = VersionProvider.class)
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/KubernetesService.java b/core/src/main/java/dev/streamx/cli/command/cloud/KubernetesService.java
deleted file mode 100644
index 3d5f7289..00000000
--- a/core/src/main/java/dev/streamx/cli/command/cloud/KubernetesService.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package dev.streamx.cli.command.cloud;
-
-import static dev.streamx.cli.command.cloud.MetadataUtils.CONFIG_TYPE_LABEL;
-import static dev.streamx.cli.command.cloud.MetadataUtils.DEFAULT_K8S_NAMESPACE;
-import static dev.streamx.cli.command.cloud.MetadataUtils.SERVICEMESH_CRD_NAME;
-import static dev.streamx.cli.command.cloud.MetadataUtils.setLabel;
-import static dev.streamx.cli.command.cloud.MetadataUtils.setMetadata;
-
-import dev.streamx.cli.command.cloud.collector.ClusterResourcesCollector;
-import dev.streamx.cli.command.cloud.collector.TypedClusterResourceCollector;
-import dev.streamx.cli.command.cloud.deploy.Config;
-import dev.streamx.cli.exception.KubernetesException;
-import dev.streamx.operator.Component;
-import dev.streamx.operator.crd.ServiceMesh;
-import io.fabric8.kubernetes.api.model.ConfigMap;
-import io.fabric8.kubernetes.api.model.ConfigMapBuilder;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.Secret;
-import io.fabric8.kubernetes.api.model.SecretBuilder;
-import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition;
-import io.fabric8.kubernetes.client.KubernetesClient;
-import io.fabric8.kubernetes.client.KubernetesClientException;
-import io.fabric8.kubernetes.client.dsl.NonDeletingOperation;
-import io.fabric8.kubernetes.client.utils.KubernetesResourceUtil;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-import org.jetbrains.annotations.NotNull;
-
-@ApplicationScoped
-public class KubernetesService {
-
- @Inject
- KubernetesClient kubernetesClient;
- @Inject
- KubernetesConfig kubernetesConfig;
-
- public void deploy(List resources) {
- resources.forEach(this::deploy);
- }
-
- private void deploy(T resource) {
- try {
- kubernetesClient.resource(resource).inNamespace(getNamespace())
- .createOr(NonDeletingOperation::update);
- } catch (KubernetesClientException e) {
- throw KubernetesException.kubernetesClientException(e);
- }
- }
-
- public void undeploy(String meshName) {
- undeploy(collectManagedResources(meshName));
- }
-
- public void undeploy(List resources) {
- try {
- resources.forEach(r -> kubernetesClient.resource(r).delete());
- } catch (KubernetesClientException e) {
- throw KubernetesException.kubernetesClientException(e);
- }
- }
-
- public List collectManagedResources(String meshName) {
- List result = new ArrayList<>();
- // Collect mesh
- ServiceMesh mesh = kubernetesClient.resources(ServiceMesh.class).inNamespace(getNamespace())
- .withName(meshName).get();
- if (mesh != null) {
- result.add(mesh);
- }
-
- // Collect configs and secrets
- result.addAll(
- new TypedClusterResourceCollector(kubernetesClient, List.of(ConfigMap.class, Secret.class),
- getNamespace()).collect(meshName));
-
- // Collect other resources controlled by the CLI
- result.addAll(new ClusterResourcesCollector(kubernetesClient,
- getControlledResourceDefinitions(), getNamespace()).collect(meshName));
-
- return result;
- }
-
- public void validateCrdInstallation() {
- try {
- CustomResourceDefinition crd = kubernetesClient.apiextensions().v1()
- .customResourceDefinitions()
- .withName(SERVICEMESH_CRD_NAME)
- .get();
- if (crd == null) {
- throw KubernetesException.serviceMeshCrdNotFound();
- }
- } catch (KubernetesClientException e) {
- throw KubernetesException.kubernetesClientException(e);
- }
- }
-
- @NotNull
- public ConfigMap buildConfigMap(String meshName, Config config) {
- ConfigMap configMap = new ConfigMapBuilder()
- .withNewMetadata()
- .endMetadata()
- .addToData(config.data())
- .build();
- String sanitizedName = KubernetesResourceUtil.sanitizeName(config.name());
- setMetadata(meshName, Component.EXTERNAL_CONFIG, sanitizedName, configMap);
- setLabel(configMap, CONFIG_TYPE_LABEL, config.configType().getLabelValue());
- return configMap;
- }
-
- @NotNull
- public Secret buildSecret(String meshName, Config config) {
- Secret secret = new SecretBuilder()
- .withNewMetadata()
- .endMetadata()
- .withStringData(config.data())
- .build();
- String sanitizedName = KubernetesResourceUtil.sanitizeName(config.name());
- setMetadata(meshName, Component.EXTERNAL_SECRET, sanitizedName, secret);
- setLabel(secret, CONFIG_TYPE_LABEL, config.configType().getLabelValue());
- return secret;
- }
-
- public String getNamespace() {
- return kubernetesConfig.namespace()
- .orElse(Optional.ofNullable(kubernetesClient.getNamespace()).orElse(DEFAULT_K8S_NAMESPACE));
- }
-
- public List getResourcePaths() {
- return kubernetesConfig.resourceDirectories().map(paths -> Arrays.stream(paths.split(","))
- .map(String::trim)
- .filter(s -> !s.isEmpty())
- .collect(Collectors.toList())).orElse(List.of());
- }
-
- public List getControlledResourceDefinitions() {
- return kubernetesConfig.controlledResourceDefinitions()
- .map(paths -> Arrays.stream(paths.split(","))
- .map(String::trim)
- .filter(s -> !s.isEmpty())
- .collect(Collectors.toList())).orElse(List.of());
- }
-}
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/MetadataUtils.java b/core/src/main/java/dev/streamx/cli/command/cloud/MetadataUtils.java
index d2e3205d..46cd7bfd 100644
--- a/core/src/main/java/dev/streamx/cli/command/cloud/MetadataUtils.java
+++ b/core/src/main/java/dev/streamx/cli/command/cloud/MetadataUtils.java
@@ -1,22 +1,14 @@
package dev.streamx.cli.command.cloud;
-import dev.streamx.operator.Component;
import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.client.utils.KubernetesResourceUtil;
import java.util.HashMap;
import java.util.Map;
public class MetadataUtils {
-
- public static final String NAME_LABEL = "app.kubernetes.io/name";
- public static final String INSTANCE_LABEL = "app.kubernetes.io/instance";
- public static final String COMPONENT_LABEL = "app.kubernetes.io/component";
public static final String MANAGED_BY_LABEL = "app.kubernetes.io/managed-by";
public static final String MANAGED_BY_LABEL_VALUE = "streamx-cli";
- public static final String CONFIG_TYPE_LABEL = "mesh.streamx.dev/config-type";
public static final String PART_OF_LABEL = "app.kubernetes.io/part-of";
public static final String SERVICEMESH_CRD_NAME = "servicemeshes.streamx.dev";
- public static final String DEFAULT_K8S_NAMESPACE = "default";
private MetadataUtils() {
// No instances
@@ -29,25 +21,11 @@ public static Map createPartOfAndManagedByLabels(String meshName
);
}
- public static void setMetadata(String meshName, Component component, String name,
- HasMetadata resource) {
- String instanceName = getResourceName(meshName, component.getShortName(), name);
- resource.getMetadata().setName(instanceName);
- setLabel(resource, INSTANCE_LABEL, instanceName);
- setLabel(resource, COMPONENT_LABEL, component.getName());
- setLabel(resource, NAME_LABEL, name);
- setManagedByAndPartOfLabels(resource, meshName);
- }
-
public static void setManagedByAndPartOfLabels(HasMetadata resource, String meshName) {
setLabel(resource, PART_OF_LABEL, meshName);
setLabel(resource, MANAGED_BY_LABEL, MANAGED_BY_LABEL_VALUE);
}
- public static String getResourceName(String meshName, String componentName, String name) {
- return KubernetesResourceUtil.sanitizeName(meshName + "-" + componentName + "-" + name);
- }
-
public static void setLabel(HasMetadata resource, String key, String value) {
if (resource.getMetadata().getLabels() == null) {
resource.getMetadata().setLabels(new HashMap<>());
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/ProjectPathsResolver.java b/core/src/main/java/dev/streamx/cli/command/cloud/ProjectPathsResolver.java
deleted file mode 100644
index 14d9b397..00000000
--- a/core/src/main/java/dev/streamx/cli/command/cloud/ProjectPathsResolver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package dev.streamx.cli.command.cloud;
-
-import dev.streamx.cli.command.meshprocessing.MeshResolver;
-import jakarta.enterprise.context.ApplicationScoped;
-import java.nio.file.Path;
-import org.jetbrains.annotations.NotNull;
-
-@ApplicationScoped
-public class ProjectPathsResolver {
-
- public static final String CONFIGS_DIRECTORY = "configs";
- public static final String SECRETS_DIRECTORY = "secrets";
- protected static final String YAML_EXT = ".yaml";
- static final String DEPLOYMENT = "deployment";
- static final String DEPLOYMENT_FILE_NAME = DEPLOYMENT + YAML_EXT;
-
- @NotNull
- public Path resolveDeploymentPath(Path meshPath) {
- String meshFileName = meshPath.getFileName().toString();
- String deploymentFileName = DEPLOYMENT_FILE_NAME;
- if (!MeshResolver.MESH_YAML.equals(meshFileName)) {
- deploymentFileName = DEPLOYMENT + "." + meshFileName;
- }
- return meshPath.getParent().resolve(deploymentFileName);
- }
-
- public Path resolveSecretPath(Path projectPath, String sourcePath) {
- return resolveSourcePath(projectPath, SECRETS_DIRECTORY, sourcePath);
- }
-
- public Path resolveConfigPath(Path projectPath, String sourcePath) {
- return resolveSourcePath(projectPath, CONFIGS_DIRECTORY, sourcePath);
- }
-
- private Path resolveSourcePath(Path projectPath, String sourceDirectory, String sourcePath) {
- return projectPath.resolve(sourceDirectory).resolve(sourcePath);
- }
-}
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/ServiceMeshResolver.java b/core/src/main/java/dev/streamx/cli/command/cloud/ServiceMeshResolver.java
deleted file mode 100644
index 0b963aa0..00000000
--- a/core/src/main/java/dev/streamx/cli/command/cloud/ServiceMeshResolver.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package dev.streamx.cli.command.cloud;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import dev.streamx.cli.interpolation.Interpolating;
-import dev.streamx.cli.util.ExceptionUtils;
-import dev.streamx.mesh.model.AbstractContainer;
-import dev.streamx.mesh.model.AbstractFromSource;
-import dev.streamx.mesh.model.DeliveryService;
-import dev.streamx.mesh.model.EnvironmentFrom;
-import dev.streamx.mesh.model.VolumesFrom;
-import dev.streamx.operator.crd.ServiceMesh;
-import dev.streamx.operator.crd.ServiceMeshSpec;
-import dev.streamx.operator.crd.deployment.ServiceMeshDeploymentConfig;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-@ApplicationScoped
-public class ServiceMeshResolver {
-
- public static final String SERVICE_MESH_NAME = "sx";
- @Inject
- @Interpolating
- ObjectMapper objectMapper;
-
- @Inject
- ProjectPathsResolver projectPathsResolver;
-
- @NotNull
- public ServiceMesh resolveMesh(Path meshPath) {
- File meshPathFile = meshPath.toFile();
- if (!meshPathFile.exists()) {
- throw new RuntimeException("Mesh file with provided path '" + meshPath + "' does not exist.");
- }
- if (meshPathFile.length() < 1) {
- throw new RuntimeException("Mesh file with provided path '" + meshPath + "' is empty.");
- }
- ServiceMesh serviceMesh = new ServiceMesh();
- try {
- ServiceMeshSpec spec = objectMapper.readValue(meshPathFile,
- ServiceMeshSpec.class);
- ServiceMeshDeploymentConfig serviceMeshDeploymentConfig = readDeploymentConfig(meshPath);
- spec.setDeploymentConfig(serviceMeshDeploymentConfig);
- serviceMesh.setSpec(spec);
- serviceMesh.getMetadata().setName(SERVICE_MESH_NAME);
- } catch (IOException e) {
- throw new RuntimeException(
- ExceptionUtils.appendLogSuggestion(
- "Unable to read mesh definition from '" + meshPath + "'.\n"
- + "\n"
- + "Details:\n"
- + e.getMessage()), e);
- }
- return serviceMesh;
- }
-
- @NotNull
- public ConfigSourcesPaths extractConfigSourcesPaths(ServiceMesh serviceMesh) {
- Set configEnvPaths = new HashSet<>();
- Set secretEnvPaths = new HashSet<>();
- Set configVolumePaths = new HashSet<>();
- Set secretVolumePaths = new HashSet<>();
- processGlobalEnvSources(serviceMesh, configEnvPaths, secretEnvPaths);
- List containers = extractContainers(serviceMesh);
- containers.forEach(container -> {
- EnvironmentFrom environmentFrom = container.getEnvironmentFrom();
- configEnvPaths.addAll(
- extractConfigSourcesPaths(environmentFrom, AbstractFromSource::getConfigs, null));
- secretEnvPaths.addAll(
- extractConfigSourcesPaths(environmentFrom, AbstractFromSource::getSecrets, null));
- VolumesFrom volumesFrom = container.getVolumesFrom();
- configVolumePaths.addAll(
- extractConfigSourcesPaths(volumesFrom, AbstractFromSource::getConfigs,
- this::mapToHostPath));
- secretVolumePaths.addAll(
- extractConfigSourcesPaths(volumesFrom, AbstractFromSource::getSecrets,
- this::mapToHostPath));
- });
-
- return new ConfigSourcesPaths(configEnvPaths, secretEnvPaths, configVolumePaths,
- secretVolumePaths);
- }
-
- @NotNull
- private List extractConfigSourcesPaths(AbstractFromSource fromSource,
- Function> pathsExtractor, Function mapper) {
- List configsPaths = Collections.emptyList();
- if (fromSource != null) {
- List extractedPaths = pathsExtractor.apply(fromSource);
- if (extractedPaths != null) {
- configsPaths = extractedPaths.stream().filter(Objects::nonNull).toList();
- if (mapper != null) {
- configsPaths = configsPaths.stream().map(mapper).collect(Collectors.toList());
- }
- }
- }
- return configsPaths;
- }
-
- @Nullable
- private ServiceMeshDeploymentConfig readDeploymentConfig(Path meshPath) {
- Path deploymentPath = projectPathsResolver.resolveDeploymentPath(meshPath);
- ServiceMeshDeploymentConfig serviceMeshDeploymentConfig = null;
- File deploymentFile = deploymentPath.toFile();
- if (deploymentFile.exists() && deploymentFile.length() > 0) {
- try {
- serviceMeshDeploymentConfig = objectMapper.readValue(deploymentFile,
- ServiceMeshDeploymentConfig.class);
- } catch (IOException e) {
- throw new RuntimeException(
- ExceptionUtils.appendLogSuggestion(
- "Unable to read deployment from '" + deploymentPath + "'.\n"
- + "\n"
- + "Details:\n"
- + e.getMessage()), e);
- }
- }
- return serviceMeshDeploymentConfig;
- }
-
- @NotNull
- List extractContainers(ServiceMesh serviceMesh) {
- ServiceMeshSpec serviceMeshSpec = serviceMesh.getSpec();
- List containers = Stream.of(
- serviceMeshSpec.getIngestion(),
- serviceMeshSpec.getProcessing(),
- serviceMeshSpec.getDelivery()
- ).filter(Objects::nonNull).map(Map::values)
- .flatMap(Collection::stream).collect(Collectors.toList());
- containers.addAll(
- Optional.ofNullable(serviceMeshSpec.getDelivery())
- .orElse(Collections.emptyMap())
- .values()
- .stream()
- .map(DeliveryService::getComponents)
- .filter(Objects::nonNull)
- .map(Map::values)
- .flatMap(Collection::stream)
- .toList()
- );
- return containers;
- }
-
- private void processGlobalEnvSources(ServiceMesh serviceMesh, Set envConfigsPaths,
- Set envSecretsPaths) {
- EnvironmentFrom globalEnvironmentFrom = serviceMesh.getSpec().getEnvironmentFrom();
- if (globalEnvironmentFrom != null) {
- List globalEnvironmentFromConfigs = globalEnvironmentFrom.getConfigs();
- if (globalEnvironmentFromConfigs != null) {
- envConfigsPaths.addAll(globalEnvironmentFromConfigs);
- }
- List globalEnvironmentFromSecrets = globalEnvironmentFrom.getSecrets();
- if (globalEnvironmentFromSecrets != null) {
- envSecretsPaths.addAll(globalEnvironmentFromSecrets);
- }
- }
- }
-
- private String mapToHostPath(String volumeConf) {
- return volumeConf.split(":")[0];
- }
-
- public record ConfigSourcesPaths(Set configEnvPaths, Set secretEnvPaths,
- Set configVolumePaths, Set secretVolumePaths) {
-
- }
-}
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/deploy/Config.java b/core/src/main/java/dev/streamx/cli/command/cloud/deploy/Config.java
deleted file mode 100644
index 3b51421e..00000000
--- a/core/src/main/java/dev/streamx/cli/command/cloud/deploy/Config.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package dev.streamx.cli.command.cloud.deploy;
-
-import java.util.Map;
-
-public record Config(String name, Map data, ConfigType configType) {
-
- public enum ConfigType {
- DIR, FILE;
-
- public String getLabelValue() {
- return this.toString().toLowerCase();
- }
- }
-}
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/deploy/ConfigService.java b/core/src/main/java/dev/streamx/cli/command/cloud/deploy/ConfigService.java
deleted file mode 100644
index 44d31829..00000000
--- a/core/src/main/java/dev/streamx/cli/command/cloud/deploy/ConfigService.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package dev.streamx.cli.command.cloud.deploy;
-
-import dev.streamx.cli.command.cloud.ProjectPathsResolver;
-import dev.streamx.cli.command.cloud.deploy.Config.ConfigType;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
-import java.io.File;
-import java.nio.file.Path;
-import java.util.Map;
-import java.util.function.Function;
-import org.jetbrains.annotations.NotNull;
-
-@ApplicationScoped
-public class ConfigService {
-
- @Inject
- DataService dataService;
-
- @Inject
- ProjectPathsResolver projectPathsResolver;
-
- @NotNull
- public Config getSecretVolume(Path projectPath, String configPath) {
- return getConfig(configPath, getSecretConfigPathMapper(projectPath),
- dataService::loadDataFromFiles, this::getConfigType);
- }
-
- @NotNull
- public Config getConfigVolume(Path projectPath, String configPath) {
- return getConfig(configPath, getConfigPathMapper(projectPath),
- dataService::loadDataFromFiles, this::getConfigType);
- }
-
- @NotNull
- public Config getSecretEnv(Path projectPath, String configPath) {
- return getConfig(configPath, getSecretConfigPathMapper(projectPath),
- dataService::loadDataFromProperties, path -> ConfigType.FILE);
- }
-
- @NotNull
- public Config getConfigEnv(Path projectPath, String configPath) {
- return getConfig(configPath, getConfigPathMapper(projectPath),
- dataService::loadDataFromProperties, path -> ConfigType.FILE);
- }
-
- @NotNull
- private Function getSecretConfigPathMapper(Path projectPath) {
- return (path) -> projectPathsResolver.resolveSecretPath(projectPath, path);
- }
-
- @NotNull
- private Function getConfigPathMapper(Path projectPath) {
- return (path) -> projectPathsResolver.resolveConfigPath(projectPath, path);
- }
-
- @NotNull
- private Config getConfig(String configPath, Function pathMapper,
- Function> dataMapper, Function configTypeMapper) {
- Path mappedPath = pathMapper.apply(configPath);
- Map data = dataMapper.apply(mappedPath);
- ConfigType configType = configTypeMapper.apply(mappedPath);
- return new Config(configPath, data, configType);
- }
-
- @NotNull
- ConfigType getConfigType(Path dataSourcePath) {
- File dataSource = dataSourcePath.toFile();
- if (dataSource.isFile()) {
- return ConfigType.FILE;
- }
- if (dataSource.isDirectory()) {
- return ConfigType.DIR;
- }
- throw new IllegalStateException(
- "Config source " + dataSource + " provided in Mesh should be file or directory.");
- }
-}
diff --git a/core/src/main/java/dev/streamx/cli/command/cloud/deploy/DataService.java b/core/src/main/java/dev/streamx/cli/command/cloud/deploy/DataService.java
deleted file mode 100644
index 8dce4263..00000000
--- a/core/src/main/java/dev/streamx/cli/command/cloud/deploy/DataService.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package dev.streamx.cli.command.cloud.deploy;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Stream;
-
-@ApplicationScoped
-public class DataService {
-
- private static final Pattern validKeyPattern = Pattern.compile("[-._a-zA-Z0-9]+");
-
- public Map loadDataFromProperties(Path propertiesFilePath) {
- File propertiesFile = propertiesFilePath.toFile();
- if (!propertiesFile.exists() || !propertiesFile.isFile()) {
- throw new IllegalStateException("Path " + propertiesFilePath.normalize()
- + " provided in Mesh must be a valid properties file.");
- }
- Properties properties = new Properties();
- try (FileInputStream fis = new FileInputStream(propertiesFile)) {
- properties.load(fis);
- Map data = new HashMap<>();
- for (Map.Entry