-
Notifications
You must be signed in to change notification settings - Fork 842
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
Easier config to mirror Hackage #5870
Comments
To make the Looking at the current Also, I see the underlying Perhaps, ultimately, it would be better to have (the singular): package-index:
download-prefix:
hackage-security:
... and to separate out the Then, some users could validly specify in their package-index:
download-prefix: https://artifactory.example.com/hackage/ I suppose the changes would need to start with changes to the Pantry API. Perhaps Pantry could have: -- Replaces the existing HaskellSecurityConfig (which seems like a misnomer)
data PackageIndexConfig = PackageIndexConfig
{ picDownloadPrefix :: !Text
, picHaskellSecurityConfig :: !HaskellSecurityConfig
}
-- A new HaskellSecurityConfig, that deals with only the Haskell Security aspects
data HaskellSecurityConfig = HaskellSecurityConfig
{ hscKeyIds :: ![Text]
, hscKeyThreshold :: !Int
, hscIgnoreExpiry :: !Bool
} |
You should consider the possibility that you have multiple prefixes. Otherwise the design is too limited. |
@hasufell, on the possibility of multiple prefixes, I can't immediately see how that possibility would arise. Currently Stack uses 'the' package index, either Hackage or (if so configured) a mirror of Hackage. If a Stack user is using 'Mirror A' of Hackage but wants to shift to 'Mirror B' of Hackage, they re-configure Stack. I am imaging a command Edit: the current hsc <-
case getFirst configMonoidPackageIndices of
Nothing -> pure defaultHackageSecurityConfig
Just [hsc] -> pure hsc
Just x -> error $ "When overriding the default package index, you must provide exactly one value, received: " ++ show x |
I am planning (subject to my proposals being acceptable to Stack collaborators) to implement this in four stages: (1) change the Pantry API - (1) and (2) would happen at the same time (and would need an upper bound for the (3) and (4) are, I think, relatively straightforward once (1) and (2) are in place. EDIT: (4) may require a little thought because the current |
…fig` This pull request proposes a relatively minor, but breaking, change to Pantry's API. There is a corresponding pull request for Stack that adopts this version of the Pantry API. The motivation for this proposal is the request at Stack issue [#5870](commercialhaskell/stack#5870). What is currently referred to as `HackageSecurityConfig` is better named `PackageIndexConfig`, comprising a true `HackageSecuityConfig` value and a download prefix (`picDownloadPrefix :: !Text`). What is currently referred to as `defaultHackageSecurityConfig` is renamed `defaultPackageIndexConfig`. True `HackageSecurityConfig` (strictly, `WithJSONWarnings HackageSecurityConfig`) has its own instance of `FromJSON` and its own default: `defaultHackageSecurityConfig`. Meeting the ask in the Stack issue, the instance of `FromJSON` for `PackageIndexConfig` now assigns a default value of `defaultHackageSecurityConfig` if the `hackage-security` key is absent from the JSON object. The field of `PackageConfig` named `pcHackageSecuity :: !HackageSecurityConfig` is renamed `pcPackageIndex :: !PackageIndexConfig`. For completeness, `defaultDownloadPrefix` is also exposed.
See also the related Pantry pull request: commercialhaskell/pantry#61.
I have raised pull requests for steps (1) (in Pantry) and (2) (in Stack) referred to in #5870 (comment) above. @brandonchinn178, steps (1) and (2) alone should give effect to the default - because I decided to propose the default in the Pantry change rather than in Stack. I've tested by building a minimal program with a resolver: lts-19.28
packages:
- .
package-indices:
- download-prefix: https://artifactory.example.com/hackage/ |
…fig` This pull request proposes a relatively minor, but breaking, change to Pantry's API. There is a corresponding pull request for Stack that adopts this version of the Pantry API. The motivation for this proposal is the request at Stack issue [#5870](commercialhaskell/stack#5870). What is currently referred to as `HackageSecurityConfig` is better named `PackageIndexConfig`, comprising a true `HackageSecuityConfig` value and a download prefix (`picDownloadPrefix :: !Text`). What is currently referred to as `defaultHackageSecurityConfig` is renamed `defaultPackageIndexConfig`. True `HackageSecurityConfig` (strictly, `WithJSONWarnings HackageSecurityConfig`) has its own instance of `FromJSON` and its own default: `defaultHackageSecurityConfig`. Meeting the ask in the Stack issue, the instance of `FromJSON` for `PackageIndexConfig` now assigns a default value of `defaultHackageSecurityConfig` if the `hackage-security` key is absent from the JSON object. The field of `PackageConfig` named `pcHackageSecuity :: !HackageSecurityConfig` is renamed `pcPackageIndex :: !PackageIndexConfig`. For completeness, `defaultDownloadPrefix` is also exposed.
See also the related Pantry pull request: commercialhaskell/pantry#61.
See also the related Pantry pull request: commercialhaskell/pantry#61.
See also the related Pantry pull request: commercialhaskell/pantry#61.
See also the related Pantry pull request: commercialhaskell/pantry#61.
Fix #5870 Provide default for `hackage-security` key
|
Fix #5870 Introduce package-index key
Stack in the |
Fix #5870 Add `stack config set package-index download-prefix` command
@brandonchinn178, all of what I proposed to do to clear this issue is now reflected in the |
Thanks! Looks great, excited to use it! |
Our company has an Artifactory instance that we've set up to mirror/cache Hackage urls; i.e.
https://artifactory.example.com/hackage/foo/bar
will mirror and cachehttps://hackage.haskell.org/foo/bar
.Currently it's annoying to configure Stack to use this mirror; currently we have to manually create
~/.stack/config.yaml
containingSince the mirror is basically the same thing as Hackage, there's no point in duplicating all the keyids and whatnot; presumably this is all information already bundled in the Stack executable anyway.
It would be nice to have a way to just specify a URL and have it configured with the default configuration, e.g.:
The text was updated successfully, but these errors were encountered: