-
-
Notifications
You must be signed in to change notification settings - Fork 894
✨ Allow using a different Hex deployment #5173
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
base: main
Are you sure you want to change the base?
Conversation
e649dc9 to
c2337e0
Compare
c2337e0 to
df23e3f
Compare
|
This seems to have extended the scope- it permits the API endpoint to be configured too, which is unrelated to enabling the use of mirrors? Is your goal here to enable alternative Hex deployments to be used? I think we would need to think more about how the configuration would work in this case. |
|
It was my understanding that the scope grew to encompass alternative deployments of the API endpoint as well. Please let me know if I've misunderstood! I'm also not entirely convinced this is the best way to go forward — mostly due the authentication complications that I don't think can be adequately addressed with environment variables alone. |
|
Ah! Sorry about that, I was not up to date with the issue. I think this is useful still! @maennchen was just asking for the ability to use a different Hex instance, which this could be the foundation of. I'm not sure if this is enough yet though? |
|
My use case is being able to switch to a different server for Hex entirely. We'll be using that for a security audit on Hex.pm and we'd like to switch to a testing hex server to not pollute production hex. For that, we'd for sure also need to be able to overwrite the signing public key: gleam/compiler-core/src/hex.rs Lines 15 to 24 in ba32828
And we'd need to point to a different server also for publish etc. commands. |
Closes #2817
This PR adds support for hex mirrors using the
HEXPM_REPOSITORY_URLandHEXPM_API_URLenvironment variables.If they are set, the respective base URLs will be used read operations like version resolution and fetching of packages. Note that these are only mirrors. Fully private repositories are not supported, so package publishing, updating, etc. disregards these variables.
I've manually tested these changes and made sure the only remaining calls to
hexpm::Config::newhappen in the publish, retire, etc. commands, but please let me know if you can think of a way to add automated tests.Please also let me know of any places where I should document these environment variables!
(Lack of) Authentication
I initially wanted to implement authentication as well. This would have been easy before, but unfortunately the addition of mirrors complicated things quite a bit. As the repository and api mirror don't necessarily belong together, we would have to juggle up to 3 different authentication tokens ("main" hexpm instance for publishing operations, api mirror, and repository mirror.)
Therefore, I think we would need two additional configuration options to set authentication tokens. Something like
HEXPM_REPOSITORY_MIRROR_API_KEY. On top of that,hexpm-rustrequires you pass it two URLs but only a single token, so that would also need to be adapted.