Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Support for multiple paths during secrets Injection #2881

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Mhammad-riyaz
Copy link

Description 📣

This pull request introduces the enhancement for the CLI tool to support multiple paths separated by commas during the RUN command . Previously, the tool only accepted a single path, which was limiting for users needing to include multiple directories or files simultaneously.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

infisica-cli-multiple-paths.mp4
    // Split paths if multiple paths are provided, separated by commas
    const pathList = path.split(",").map((p) => p.trim());
    if (recursive) {
      for(const currentPath of pathList){
        const deepPaths = await recursivelyGetSecretPaths({
          folderDAL,
          projectEnvDAL,
          projectId,
          environment,
          currentPath
        });
        if (!deepPaths) continue;
        // concatenate each array returned from deepPaths.map to paths to get the final array.
        paths = paths.concat(deepPaths.map(({ folderId, path: p }) => ({ folderId, path: p })));
      }
    } else {
      for(const currentPath of pathList){
        const folder = await folderDAL.findBySecretPath(projectId, environment, currentPath);
        if (!folder) continue;
        // push each path to the paths
        paths.push({ folderId: folder.id, path });
      }
    }

    if(paths?.length === 0) return { secrets: [], imports: [] };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant