Add GoSRT & improvements (repo-merge)

Commits (Ingo Oppermann):
- Add experimental SRT connection stats and logs
- Hide /config/reload endpoint in reade-only mode
- Add SRT server
- Create v16 in go.mod
- Fix data races, tests, lint, and update dependencies
- Add trailing slash for routed directories (datarhei/restreamer#340)
- Allow relative URLs in content in static routes

Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
This commit is contained in:
Jan Stabenow
2022-06-23 22:13:58 +02:00
parent d7db9e4efe
commit eb1cc37456
323 changed files with 17524 additions and 10050 deletions

View File

@@ -22,6 +22,22 @@ type Config struct {
InstanceName string
DeepLinking bool
PersistAuthorization bool
// The information for OAuth2 integration, if any.
OAuth *OAuthConfig
}
// OAuthConfig stores configuration for Swagger UI OAuth2 integration. See
// https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/ for further details.
type OAuthConfig struct {
// The ID of the client sent to the OAuth2 IAM provider.
ClientId string
// The OAuth2 realm that the client should operate in. If not applicable, use empty string.
Realm string
// The name to display for the application in the authentication popup.
AppName string
}
// URL presents the url pointing to API definition (normally swagger.json or swagger.yaml).
@@ -67,6 +83,12 @@ func PersistAuthorization(persistAuthorization bool) func(*Config) {
}
}
func OAuth(config *OAuthConfig) func(*Config) {
return func(c *Config) {
c.OAuth = config
}
}
func newConfig(configFns ...func(*Config)) *Config {
config := Config{
URL: "doc.json",
@@ -250,6 +272,15 @@ window.onload = function() {
],
layout: "StandaloneLayout"
})
{{if .OAuth}}
ui.initOAuth({
clientId: "{{.OAuth.ClientId}}",
realm: "{{.OAuth.Realm}}",
appName: "{{.OAuth.AppName}}"
})
{{end}}
window.ui = ui
}
</script>