mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 10:41:03 +01:00
README: update supporters
there are four more waiting for github username confirmation
This commit is contained in:
parent
a491cdf7ef
commit
e98fd21c83
|
@ -27,6 +27,7 @@ Learn what [others saying about Iris](https://iris-go.com/testimonials/) and **[
|
|||
## 👑 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7DPAYRDR28MMJ&item_name=Iris+Web+Framework¤cy_code=EUR&source=url">Supporters</a>
|
||||
|
||||
<p>
|
||||
<a href="https://github.com/AlbinoGeek"><img src="https://avatars1.githubusercontent.com/u/1910461?v=4" alt ="Damon Blais" title="AlbinoGeek" with="75" style="width:75px;max-width:75px;height:75px" height="75" /></a>
|
||||
<a href="https://github.com/LYF123123"><img src="https://avatars1.githubusercontent.com/u/33317812?v=4" alt ="陆 轶丰" title="LYF123123" with="75" style="width:75px;max-width:75px;height:75px" height="75" /></a>
|
||||
<a href="https://github.com/xiaozhuai"><img src="https://avatars1.githubusercontent.com/u/4773701?v=4" alt ="Weihang Ding" title="xiaozhuai" with="75" style="width:75px;max-width:75px;height:75px" height="75" /></a>
|
||||
<a href="https://github.com/fangli"><img src="https://avatars1.githubusercontent.com/u/3032639?v=4" alt ="Li Fang" title="fangli" with="75" style="width:75px;max-width:75px;height:75px" height="75" /></a>
|
||||
|
|
50
apps/apps.go
50
apps/apps.go
|
@ -2,3 +2,53 @@
|
|||
// This package directly imports the iris root package and cannot be used
|
||||
// inside Iris' codebase itself. Only external packages/programs can make use of it.
|
||||
package apps
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/v12"
|
||||
"github.com/kataras/iris/v12/context"
|
||||
)
|
||||
|
||||
// Get returns an existing Iris Application based on its "appName".
|
||||
// Applications of the same program
|
||||
// are registered automatically.
|
||||
func Get(appName string) *iris.Application {
|
||||
if app, ok := context.GetApplication(appName); ok {
|
||||
return app.(*iris.Application)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAll returns a slice of all registered Iris Applications.
|
||||
func GetAll() []*iris.Application {
|
||||
appsReadOnly := context.GetApplications()
|
||||
apps := make([]*iris.Application, 0, len(appsReadOnly))
|
||||
|
||||
for _, app := range appsReadOnly {
|
||||
apps = append(apps, app.(*iris.Application))
|
||||
}
|
||||
|
||||
return apps
|
||||
}
|
||||
|
||||
// Configure applies one or more configurator to the
|
||||
// applications with the given "appNames".
|
||||
//
|
||||
// See `ConfigureAll` too.
|
||||
func Configure(appNames []string, configurators ...iris.Configurator) {
|
||||
for _, appName := range appNames {
|
||||
if app := Get(appName); app != nil {
|
||||
app.Configure(configurators...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ConfigureAll applies one or more configurator to all
|
||||
// registered applications so far.
|
||||
//
|
||||
// See `Configure` too.
|
||||
func ConfigureAll(configurators ...iris.Configurator) {
|
||||
for _, app := range context.GetApplications() {
|
||||
app.(*iris.Application).Configure(configurators...)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,6 +123,18 @@ func RegisterApplication(app Application) {
|
|||
mu.Unlock()
|
||||
}
|
||||
|
||||
// GetApplications returns a slice of all the registered Applications.
|
||||
func GetApplications() []Application {
|
||||
mu.RLock()
|
||||
// a copy slice but the instances are pointers so be careful what modifications are done
|
||||
// the return value is read-only but it can be casted to *iris.Application.
|
||||
apps := make([]Application, 0, len(registeredApps))
|
||||
copy(apps, registeredApps)
|
||||
mu.RLock()
|
||||
|
||||
return apps
|
||||
}
|
||||
|
||||
// LastApplication returns the last registered Application.
|
||||
// Handlers has access to the current Application,
|
||||
// use `Context.Application()` instead.
|
||||
|
|
Loading…
Reference in New Issue
Block a user