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

Normalize the paths between the configuration file and module source #35

Closed
radu-matei opened this issue Feb 6, 2022 · 2 comments · Fixed by #87
Closed

Normalize the paths between the configuration file and module source #35

radu-matei opened this issue Feb 6, 2022 · 2 comments · Fixed by #87
Assignees
Labels
bug Something isn't working P0
Milestone

Comments

@radu-matei
Copy link
Member

spin up --app spin.toml must currently be run from the same directory as spin.toml, because a relative path for the component source is not handled properly:

spin/src/commands/up.rs

Lines 19 to 25 in 751cda3

/// Path to spin.toml
/// TODO
///
/// The command has to be run from the same directory
/// as the configuration file for now.
#[structopt(long = "app")]
pub app: PathBuf,

@radu-matei radu-matei added the bug Something isn't working label Feb 6, 2022
@radu-matei radu-matei added this to the v0.1.0 milestone Feb 7, 2022
@radu-matei radu-matei added the P0 label Feb 7, 2022
@michelleN michelleN self-assigned this Feb 14, 2022
@michelleN
Copy link
Member

Should we make it so that the path must be relative to the directory that the Spin.toml file lives? What happens if the user wants to specify absolutely path?

Right now I'm thinking.. if component source is a path, check if it is relative or not. Relative paths are relative to the directory where the Spin.toml file lives. If not relative, use absolute path given. How should a user denote they're supplying an absolute path? Should it be by using / at the beginning of the component source string? Should they specify the file URI scheme? https://en.wikipedia.org/wiki/File_URI_scheme

@radu-matei
Copy link
Member Author

The current implicit assumption is that the module source is relative to spin.toml, and I think the newly introduced ApplicationOrigin structure in the configuration should help with this —

/// The location from which an application was loaded.
#[derive(Clone, Debug)]
pub enum ApplicationOrigin {
/// The application was loaded from the specified file.
File(PathBuf),
}

I'd start with implicit relative vs. absolute path (i.e. "if it starts with /), and stay away of the file scheme for now. We could add it later if we think it's a use case we want to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants