README: update supporters

there are four more waiting for github username confirmation
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-08-18 19:02:20 +03:00
parent a491cdf7ef
commit e98fd21c83
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7
3 changed files with 63 additions and 0 deletions

View File

@ -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&currency_code=EUR&source=url">Supporters</a> ## 👑 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=7DPAYRDR28MMJ&item_name=Iris+Web+Framework&currency_code=EUR&source=url">Supporters</a>
<p> <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/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/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> <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>

View File

@ -2,3 +2,53 @@
// This package directly imports the iris root package and cannot be used // 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. // inside Iris' codebase itself. Only external packages/programs can make use of it.
package apps 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...)
}
}

View File

@ -123,6 +123,18 @@ func RegisterApplication(app Application) {
mu.Unlock() 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. // LastApplication returns the last registered Application.
// Handlers has access to the current Application, // Handlers has access to the current Application,
// use `Context.Application()` instead. // use `Context.Application()` instead.