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: path-based locations #288

Merged
merged 6 commits into from
Jan 6, 2025
Merged

feat: path-based locations #288

merged 6 commits into from
Jan 6, 2025

Conversation

mmalenic
Copy link
Member

@mmalenic mmalenic commented Jan 6, 2025

Closes #281
Depends on #284

Features

  • Add a simple path-based way to writing location lists that includes file://, s3:// or http(s)://.
    *The first part of the location determines the storage, and everything in the path after determines the prefix which matches on ids. For example, s3://bucket/prefix says to find files in bucket when the request also contains the prefix - /reads/prefix/.
    • Locations can be specified as either a single location, or a list of locations with [].
    • The regex-style of specifying locations is still available. Config that is considered "advanced" is separated into a module, which is reflected in the docs.
  • Paths are joined with Pathbuf rather than string formating, so config values like file://data/path and file://data/path/ are equivalent.

Docs

  • Re-worked docs to include simplified locations first, with "advanced" config included later.

Recent fixes

  • Checked all examples and fixed any errors.

@mmalenic mmalenic self-assigned this Jan 6, 2025
@mmalenic mmalenic added the enhancement New feature or request label Jan 6, 2025
@@ -1,23 +1,19 @@
# An example of running htsget-rs with Crypt4GH enabled.
# Run with `cargo run -p htsget-axum --features experimental -- --config htsget-config/examples/config-files/c4gh.toml`
# Run with `cargo run -p htsget-axum --features experimental,s3-storage -- --config htsget-config/examples/config-files/c4gh.toml`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s3-storage shouldn't be required, IMHO?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fair. It's required because the secrets manager has all the AWS dependencies, which s3-storage enables.

Originally, only S3 was required for any AWS-specific things, but now that's changed, maybe this feature should be called aws rather than s3-storage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to rename/simplify url-storage too? E.g.

s3-storage -> aws
url-storage -> url

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make this a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on the renaming, but shouldn't we have a file:// for the secrets management part? I'm thinking about local testing and/or devving, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is kind = "File" for local keys:

backend.keys.kind = "File"
backend.keys.private = "data/c4gh/keys/bob.sec" # pragma: allowlist secret
backend.keys.public = "data/c4gh/keys/alice.pub"

And kind = "SecretsManager" for secrets manager keys:

backend.keys.kind = "SecretsManager"
backend.keys.private = "htsget/test_c4gh_private_key" # pragma: allowlist secret
backend.keys.public = "htsget/test_c4gh_public_key"

Is that what you mean? Or some sort of local SecretsManager option?

Copy link
Member

@brainstorm brainstorm Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm only concerned about being able to run c4gh infra locally, without requiring aws deps... that "Run with cargo run..." line change seems to imply that s3-storage is absolutely required? From what you just said it seems it's not, perhaps being explicit about both options (only via experimental and experimental+aws feature flags) should be explicitly stated?

Copy link
Member Author

@mmalenic mmalenic Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, it's not required. It's only required if you remove the comments in that file that use kind = "SecretsManager".

I'll make this clearer on the next PR. Maybe it should just be --all-features in all the examples to avoid any confusion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it should just be --all-features in all the examples to avoid any confusion?

🤔 ... that'd exercise our error management logic and corresponding error messages, i.e: running with file:// paths and aws-related c4gh secrets management. It might make more sense this way if errors are clear, yeah!

@mmalenic mmalenic mentioned this pull request Jan 6, 2025
@mmalenic mmalenic added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit 225f6a3 Jan 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: create simplified path-based config locations
2 participants