spin icon indicating copy to clipboard operation
spin copied to clipboard

Enable finding plugins in a user-selected directory

Open itowlson opened this issue 2 years ago • 4 comments

Fixes #1870.

This is a candidate fix based on my current understanding of the requirement. If we validate that it meets the need, then I'll tidy it and put it ready for review.

itowlson avatar Oct 11 '23 03:10 itowlson

This is potentially relevant to #2555, although I'm not sure the strategy of requiring an environment variable would fit with Rancher Desktop's needs. That feels like it's closer to the Homebrew situation, which had a similar requirement to Rancher and for which we did a one-off fix: maybe we should explore a more wide-ranging, configurable equivalent to that. cc @kate-goldenring

itowlson avatar Jun 14 '24 02:06 itowlson

also cc @jandubois for visibility - looking at the issue, Rancher's needs are broader than just plugins, but it does sound like the environment variable approach would meet their needs

itowlson avatar Jun 14 '24 02:06 itowlson

I'm not sure the strategy of requiring an environment variable would fit with Rancher Desktop's needs

I was hoping for a minimal addition to default_data_dir in crates/common/src/data_dir.rs.

I'm not a Rust person, so I'm just making up stuff, but I would hope for something like this:

/// Return the default data directory for Spin
pub fn default_data_dir() -> Result<PathBuf> {
    if let Ok(spin_appdata) = std::env::var("SPIN_APPDATA") {
        return Some(spin_appdata);
    }
    …
}

Don't care about the name of the variable, but it would disable all heuristics/rules and always return the path set in the environment. It would work for both plugins and templates (and everything else you will store in the data directory in the future).

I think the issue of having an additional plugin directory is orthogonal to this feature, but of course the way these features would interact should be considered (I have not reviewed the code in this PR in detail, nor the issue that is to be fixed by it).2

jandubois avatar Jun 14 '24 04:06 jandubois

See #2563

lann avatar Jun 14 '24 14:06 lann