Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
hdacloud
dex
Commits
d1e8b085
Unverified
Commit
d1e8b085
authored
4 years ago
by
Mark Sagi-Kazar
Browse files
Options
Downloads
Patches
Plain Diff
feat: use embedded assets by default
Signed-off-by:
Mark Sagi-Kazar
<
mark.sagikazar@gmail.com
>
parent
78fcac75
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/server.go
+15
-7
15 additions, 7 deletions
server/server.go
server/templates.go
+0
-7
0 additions, 7 deletions
server/templates.go
with
15 additions
and
14 deletions
server/server.go
+
15
−
7
View file @
d1e8b085
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"io/fs"
"io/fs"
"net/http"
"net/http"
"net/url"
"net/url"
"os"
"path"
"path"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -41,6 +42,7 @@ import (
...
@@ -41,6 +42,7 @@ import (
"github.com/dexidp/dex/connector/saml"
"github.com/dexidp/dex/connector/saml"
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/storage"
"github.com/dexidp/dex/storage"
"github.com/dexidp/dex/web"
)
)
// LocalConnector is the local passwordDB connector which is an internal
// LocalConnector is the local passwordDB connector which is an internal
...
@@ -101,20 +103,20 @@ type Config struct {
...
@@ -101,20 +103,20 @@ type Config struct {
// WebConfig holds the server's frontend templates and asset configuration.
// WebConfig holds the server's frontend templates and asset configuration.
type
WebConfig
struct
{
type
WebConfig
struct
{
// A file path to
web
static
. If set, WebFS will be ignored
.
// A file path to static
web assets
.
//
//
// It is expected to contain the following directories:
// It is expected to contain the following directories:
//
//
// * static - Static static served at "( issuer URL )/static".
// * static - Static static served at "( issuer URL )/static".
// * templates - HTML templates controlled by dex.
// * templates - HTML templates controlled by dex.
// * themes/(theme) - Static static served at "( issuer URL )/theme".
// * themes/(theme) - Static static served at "( issuer URL )/theme".
//
Dir
string
Dir
string
// Alternative way to configure
web
static
filesystem. Dir overrides thi
s.
// Alternative way to
programatically
configure static
web asset
s.
// I
t's expected to contain the same files and directories as mention
ed
// I
f Dir is specified, WebFS is ignor
ed
.
//
above in Dir doc
.
//
It's expected to contain the same files and directories as mentioned above
.
//
//
// Note: this is experimental. Might get removed without notice!
WebFS
fs
.
FS
WebFS
fs
.
FS
// Defaults to "( issuer URL )/theme/logo.png"
// Defaults to "( issuer URL )/theme/logo.png"
...
@@ -210,9 +212,15 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
...
@@ -210,9 +212,15 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
supported
[
respType
]
=
true
supported
[
respType
]
=
true
}
}
webFS
:=
web
.
FS
()
if
c
.
Web
.
Dir
!=
""
{
webFS
=
os
.
DirFS
(
c
.
Web
.
Dir
)
}
else
if
c
.
Web
.
WebFS
!=
nil
{
webFS
=
c
.
Web
.
WebFS
}
web
:=
webConfig
{
web
:=
webConfig
{
dir
:
c
.
Web
.
Dir
,
webFS
:
webFS
,
webFS
:
c
.
Web
.
WebFS
,
logoURL
:
c
.
Web
.
LogoURL
,
logoURL
:
c
.
Web
.
LogoURL
,
issuerURL
:
c
.
Issuer
,
issuerURL
:
c
.
Issuer
,
issuer
:
c
.
Web
.
Issuer
,
issuer
:
c
.
Web
.
Issuer
,
...
...
This diff is collapsed.
Click to expand it.
server/templates.go
+
0
−
7
View file @
d1e8b085
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
"io/fs"
"io/fs"
"net/http"
"net/http"
"net/url"
"net/url"
"os"
"path"
"path"
"path/filepath"
"path/filepath"
"sort"
"sort"
...
@@ -45,7 +44,6 @@ type templates struct {
...
@@ -45,7 +44,6 @@ type templates struct {
}
}
type
webConfig
struct
{
type
webConfig
struct
{
dir
string
webFS
fs
.
FS
webFS
fs
.
FS
logoURL
string
logoURL
string
issuer
string
issuer
string
...
@@ -77,11 +75,6 @@ func loadWebConfig(c webConfig) (http.Handler, http.Handler, *templates, error)
...
@@ -77,11 +75,6 @@ func loadWebConfig(c webConfig) (http.Handler, http.Handler, *templates, error)
if
c
.
issuer
==
""
{
if
c
.
issuer
==
""
{
c
.
issuer
=
"dex"
c
.
issuer
=
"dex"
}
}
if
c
.
dir
!=
""
{
c
.
webFS
=
os
.
DirFS
(
c
.
dir
)
}
else
if
c
.
webFS
==
nil
{
c
.
webFS
=
os
.
DirFS
(
"./web"
)
}
if
c
.
logoURL
==
""
{
if
c
.
logoURL
==
""
{
c
.
logoURL
=
"theme/logo.png"
c
.
logoURL
=
"theme/logo.png"
}
}
...
...
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