turbot / pipe-fittings

Shared components for use across pipe projects.
https://github.com/turbot
GNU Affero General Public License v3.0
12 stars 3 forks source link

Refer to a local directory for mod dependencies? #392

Closed e-gineer closed 3 months ago

e-gineer commented 4 months ago

While doing development of mods in flowpipe or powerpipe it's common to have mod dependencies. Unfortunately right now those dependencies must be from a github repo or similar, which makes local development more difficult than I'd like.

Suggestion, can we just accept a local directory in the version attribute of the mod block? For example:

mod "aws_compliance" {
  title = "flowpipe-mod-foo"
  require {
    # local variation of a mod that often lives in github
    mod "github.com/turbot/flowpipe-mod-bar" {
      # support full paths
      version = "file:///full/path/to/local/flowpipe-mod-bar"
    }
    # purely local mod, no git ever pushed
    mod "baz" {
      # support relative paths
      version = "file:../relative/path/to/my/baz"
    }
  }
}

In this case we're allowing a "rootless path" variation of the file: scheme, which is common practice (even if not technically RFC compliant?). See https://stackoverflow.com/a/53082960

When using file based mod location I should be able to just hack away on my mod on the local machine always seeing the latest changes.

Note that mod names don't need to be in github.com/identity/repo format either - no need for that when working with local files.

e-gineer commented 4 months ago

Note that this format avoids the complexity of golang style replace directives, at the expense of requiring you to modify the actual install version and location of the mod.

kaidaguerre commented 3 months ago

fixed by 11eed7e21e5dfeff708a2b24f037bf8bb3c2f857