Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
rednerd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orus-io
rednerd
Commits
18280814
Commit
18280814
authored
7 months ago
by
Christophe de Vienne
Browse files
Options
Downloads
Patches
Plain Diff
Add a hook for api configuration by outer packages
parent
1be3817b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
restapi/configure_rednerd.go
+14
-0
14 additions, 0 deletions
restapi/configure_rednerd.go
with
14 additions
and
0 deletions
restapi/configure_rednerd.go
+
14
−
0
View file @
18280814
...
@@ -30,6 +30,14 @@
...
@@ -30,6 +30,14 @@
extraMiddleware
=
append
(
extraMiddleware
,
f
)
extraMiddleware
=
append
(
extraMiddleware
,
f
)
}
}
type
APIConfigurator
func
(
config
APIConfig
,
auth
*
auth
.
Auth
,
api
*
operations
.
RednerdAPI
)
error
var
configurators
[]
APIConfigurator
func
AddAPIConfigurator
(
cfg
APIConfigurator
)
{
configurators
=
append
(
configurators
,
cfg
)
}
// APIConfig holds the configuration options for the API.
// APIConfig holds the configuration options for the API.
type
APIConfig
struct
{
type
APIConfig
struct
{
Context
context
.
Context
Context
context
.
Context
...
@@ -121,6 +129,12 @@
...
@@ -121,6 +129,12 @@
auth
.
Close
()
auth
.
Close
()
}
}
for
_
,
cfg
:=
range
configurators
{
if
err
:=
cfg
(
config
,
auth
,
api
);
err
!=
nil
{
panic
(
err
)
}
}
handler
:=
api
.
Serve
(
setupMiddlewares
)
handler
:=
api
.
Serve
(
setupMiddlewares
)
if
s
.
Prometheus
{
if
s
.
Prometheus
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment