4 ms·
Running this without amazon seems to require replacing the hardcoded "{}://{}.s3{}.amazonaws.com" url with the location where the s3 compatible service is runni
by zeotroph 10y ago
Running this without amazon seems to require replacing the hardcoded "{}://{}.s3{}.amazonaws.com" url with the location where the s3 compatible service is running on the local network. Now if that was just a default and could be overwritten with an env var as well... :)
And minio [1] seems to be the easiest pseudo-s3 there is ($ ./minio server CacheDir/, done?), or are there better alternatives by now?
1: https://github.com/minio/minio https://github.com/minio/minio
- buckhx 10y agoRust's format macro only takes string literals as a template, so you can't provide a runtime string template. The solution seems to be adding an external templating lib, which seems like overkill for a single template.
- steveklabnik 10y agohttps://crates.io/crates/strfmt https://crates.io/crates/strfmt works too.
- chc 10y agoWouldn't that be an external templating lib?
- deleted 10y ago[deleted]
- steveklabnik 10y agoIn some sense, yes. In another, it's not some sort of different kind of templating, it's the same stuff, just calculated at runtime instead of compile time. I assume the lack of wanting a library for this is due to its weight and learning some other form of templating; this crate is pretty small, and isn't different in that way.
- Groxx 10y agoSeems like it could be replaced with just string concatenation? Slightly less pretty, perhaps, but that wouldn't require any dependencies.
- justinsaccount 10y agoWhy would you need to use a runtime string template? change new and base_url to accept an optional host parameter, if host is set return format!("{}://{}", match ssl..., host) otherwise run the existing codepath and return the amazonaws.com string.
- tedmielczarek 10y agoI'd take a patch to allow overriding the URL! I actually could use that for testing the S3 storage. The S3 code went through a few revisions. I was originally using Rusoto (https://github.com/rusoto/rusoto https://github.com/rusoto/rusoto), which is nice but just didn't quite meet my needs, so then I borrowed some code from the crates.io codebase and then rewrote most of it. You can also run it using a local disk cache, similar to ccache, but it doesn't have any code to limit the size of the cache so it's not very good right now. (It's used in all the tests, though.) Fixing that specific issue is next on my plate.