mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
update jwt dependency and use the current Party if relative path is empty on PartyConfigure only
This commit is contained in:
@@ -873,14 +873,19 @@ type PartyConfigurator interface {
|
||||
Configure(parent Party)
|
||||
}
|
||||
|
||||
// PartyConfigure like `Party` and `PartyFunc` registers a new children Party but instead it accepts a struct value.
|
||||
// It initializes a new children Party and executes the PartyConfigurator's Configure.
|
||||
// Useful when the api's dependencies amount are too much to pass on a function.
|
||||
// PartyConfigure like `Party` and `PartyFunc` registers a new children Party
|
||||
// but instead it accepts a struct value which should implement the PartyConfigurator interface.
|
||||
//
|
||||
// As an exception, if the end-developer registered one or more dependencies upfront through
|
||||
// PartyConfigure accepts the relative path of the child party
|
||||
// (As an exception, if it's empty then all configurators are applied to the current Party)
|
||||
// and one or more Party configurators and
|
||||
// executes the PartyConfigurator's Configure method.
|
||||
//
|
||||
// If the end-developer registered one or more dependencies upfront through
|
||||
// RegisterDependencies or ConfigureContainer.RegisterDependency methods
|
||||
// and "p" is a pointer to a struct then try to bind the unset/zero exported fields
|
||||
// to the registered dependencies, just like we do with Controllers.
|
||||
// Useful when the api's dependencies amount are too much to pass on a function.
|
||||
//
|
||||
// Usage:
|
||||
// app.PartyConfigure("/users", &api.UsersAPI{UserRepository: ..., ...})
|
||||
@@ -894,7 +899,14 @@ type PartyConfigurator interface {
|
||||
// app.RegisterDependency(userRepo, ...)
|
||||
// app.PartyConfigure("/users", &api.UsersAPI{})
|
||||
func (api *APIBuilder) PartyConfigure(relativePath string, partyReg ...PartyConfigurator) Party {
|
||||
child := api.Party(relativePath)
|
||||
var child Party
|
||||
|
||||
if relativePath == "" {
|
||||
child = api
|
||||
} else {
|
||||
child = api.Party(relativePath)
|
||||
}
|
||||
|
||||
for _, p := range partyReg {
|
||||
if p == nil {
|
||||
continue
|
||||
@@ -908,9 +920,15 @@ func (api *APIBuilder) PartyConfigure(relativePath string, partyReg ...PartyConf
|
||||
|
||||
p.Configure(child)
|
||||
}
|
||||
|
||||
return child
|
||||
}
|
||||
|
||||
func (api *APIBuilder) configureParty(partyReg ...PartyConfigurator) Party {
|
||||
|
||||
return api
|
||||
}
|
||||
|
||||
// Subdomain returns a new party which is responsible to register routes to
|
||||
// this specific "subdomain".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user