Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
ff981646
Commit
ff981646
authored
Oct 25, 2016
by
Eric Chiang
Committed by
GitHub
Oct 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #627 from ericchiang/dev-expand-envs-in-config
*: expand environment variables in config
parents
101a2bc2
a11db557
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
6 deletions
+15
-6
serve.go
cmd/dex/serve.go
+2
-0
github.go
connector/github/github.go
+2
-3
oidc.go
connector/oidc/oidc.go
+2
-3
config-dev.yaml
examples/config-dev.yaml
+9
-0
No files found.
cmd/dex/serve.go
View file @
ff981646
...
...
@@ -7,6 +7,7 @@ import (
"log"
"net"
"net/http"
"os"
"github.com/spf13/cobra"
"golang.org/x/net/context"
...
...
@@ -44,6 +45,7 @@ func serve(cmd *cobra.Command, args []string) error {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"read config file %s: %v"
,
configFile
,
err
)
}
configData
=
[]
byte
(
os
.
ExpandEnv
(
string
(
configData
)))
var
c
Config
if
err
:=
yaml
.
Unmarshal
(
configData
,
&
c
);
err
!=
nil
{
...
...
connector/github/github.go
View file @
ff981646
...
...
@@ -6,7 +6,6 @@ import (
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
"golang.org/x/net/context"
...
...
@@ -32,8 +31,8 @@ func (c *Config) Open() (connector.Connector, error) {
redirectURI
:
c
.
RedirectURI
,
org
:
c
.
Org
,
oauth2Config
:
&
oauth2
.
Config
{
ClientID
:
os
.
ExpandEnv
(
c
.
ClientID
)
,
ClientSecret
:
os
.
ExpandEnv
(
c
.
ClientSecret
)
,
ClientID
:
c
.
ClientID
,
ClientSecret
:
c
.
ClientSecret
,
Endpoint
:
github
.
Endpoint
,
Scopes
:
[]
string
{
"user:email"
,
// View user's email
...
...
connector/oidc/oidc.go
View file @
ff981646
...
...
@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"net/http"
"os"
"github.com/ericchiang/oidc"
"golang.org/x/net/context"
...
...
@@ -42,12 +41,12 @@ func (c *Config) Open() (conn connector.Connector, err error) {
scopes
=
append
(
scopes
,
"profile"
,
"email"
)
}
clientID
:=
os
.
ExpandEnv
(
c
.
ClientID
)
clientID
:=
c
.
ClientID
return
&
oidcConnector
{
redirectURI
:
c
.
RedirectURI
,
oauth2Config
:
&
oauth2
.
Config
{
ClientID
:
clientID
,
ClientSecret
:
os
.
ExpandEnv
(
c
.
ClientSecret
)
,
ClientSecret
:
c
.
ClientSecret
,
Endpoint
:
provider
.
Endpoint
(),
Scopes
:
scopes
,
RedirectURL
:
c
.
RedirectURI
,
...
...
examples/config-dev.yaml
View file @
ff981646
...
...
@@ -37,6 +37,15 @@ connectors:
-
type
:
mockCallback
id
:
mock
name
:
Example
# - type: oidc
# id: google
# name: Google
# config:
# issuer: https://accounts.google.com
# # Config values starting with a "$" will read from the environment.
# clientID: $GOOGLE_CLIENT_ID
# clientSecret: $GOOGLE_CLIENT_SECRET
# redirectURI: http://127.0.0.1:5556/dex/callback/google
# Let dex keep a list of passwords which can be used to login the user
enablePasswordDB
:
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment