-
Notifications
You must be signed in to change notification settings - Fork 9
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
More flexible config #126
More flexible config #126
Conversation
… and allow methods
…ve around config options
…nable data server
…lexible-config-rename # Conflicts: # htsget-config/README.md # htsget-config/src/config.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah, that was a beefy PR, sorry it took me a while to go through :-O As you mentioned, try to keep them smaller in the future if you can!
Other than the minor details I commented and running cargo clippy --all-targets --all-features --fix
and cargo fmt
, I'd advise merging it today instead of later in January as you have this fresh on your head? ;)
Happy xmas and NY otherwise!
htsget-config/README.md
Outdated
| `bucket` | The AWS S3 bucket where resources can be retrieved from. | String | `''` | | ||
|
||
Additionally, the resolver component has a feature, which allows resolving IDs based on the other fields present in a query. | ||
This is useful as allows the resolver to match only match an ID, if a particular set of query parameters are also present. For example, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*match only an ID
htsget-config/README.md
Outdated
|
||
The resolvers component of htsget-rs is used to map query IDs to the location of the resource. Each query that htsget-rs receives is | ||
'resolved' to a location, which a data server can respond with. A query ID is matched with a regex, and is then mapped with a substitution string that | ||
has access to the regex capture groups. Each resolver is an array of TOML of tables that attempts to match a query ID. This array matches IDs in order, meaning that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each resolver is an array of TOML of tables
I'd rephrase that :-?
htsget-config/README.md
Outdated
This is useful as allows the resolver to match only match an ID, if a particular set of query parameters are also present. For example, | ||
a resolver can be set to only resolve IDs if the format is also BAM. | ||
|
||
To set the resolver 'allow guard', add a `[resolver.allow_guard]` table, and set the following options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's an "allow guard" resolver?
allow_interval_start = 100 | ||
allow_interval_end = 1000 | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for example, this resolver would... only allow queries to chr1 between positions 100 and 1000 on BAMs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll clarify that a bit in the docs.
htsget-config/README.md
Outdated
|
||
#### Configuring htsget-rs with environment variables | ||
|
||
All the htsget-rs config options can be set by environment variables. The ticket server, data server and service info options are flattened and can be set directly using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the htsget-rs config options can be set by environment variables
, which is convenient for runtimes such as AWS Lambda
htsget-http-lambda/src/lib.rs
Outdated
@@ -493,7 +485,7 @@ mod tests { | |||
assert!(router.get_route(&Method::DELETE, &uri).is_none()); | |||
}, | |||
&config, | |||
formatter_from_config(&config), | |||
formatter_from_config(&config).unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd try to avoid this series of .unwrap()
here and below if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this one could definitely be avoided.
Although, this made me think of a different point. All our tests use unwraps to panic, however there is also support to return a Result
from a test which could lead to more informative errors and make them more concise. Do you think it would be good for our tests to return a Result
? (obviously this is for a different PR, and not super high priority)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I tend to prefer avoiding unwrap()
even in small examples for that kind of reason. Different issue/PR if that's a big refactor, agreed.
Thanks for the review! Happy Xmas 😃 How do you feel about the commits and the messages? From now on, I would try and just use a particular commit style so that I don't have to reword things. |
I still haven't had time to review the integrations with conventional commits, but I think that |
Yep, that's fair. Also need to do a bit more review with how this works, but would each |
…rround environment variables in backticks.
Closes #102
Apologies for the very large PR, there is a bunch of changes here.
Changes
RegexResolvers
are allowed, which can be configured using an array, where the first matching resolver is the one used for the query ID mapping.Bam
, for example.--print-default-config
flag can be passed as a command line arg to print the default TOML config to stdout.Issues
There are still some issues that can be addressed in other PRs.
.bam
, issue Arbitrary file endings for mapped resources #127.[[resolvers]]
array of tables, however this can still be set from an environment variable, and the additional features are not required. The defaults should be the same when running htsget-rs with no configuration.This PR and branch is also an experiment on using somewhat more conventional commits to see how we feel about it. I haven't used many of the standard types such as
feat
orbug
, but I have added custom types that mostly describe the scope of the change.Also happy to revert this and squash it as one if we think it's better.