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
96fb0733
Commit
96fb0733
authored
Nov 06, 2016
by
Eric Chiang
Committed by
GitHub
Nov 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #669 from ericchiang/config-env
cmd/dex: only expand from env for storages and connectors
parents
5302fefd
015e7cf6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
config.go
cmd/dex/config.go
+5
-2
config_test.go
cmd/dex/config_test.go
+4
-5
serve.go
cmd/dex/serve.go
+0
-2
config-dev.yaml
examples/config-dev.yaml
+1
-1
No files found.
cmd/dex/config.go
View file @
96fb0733
...
...
@@ -4,6 +4,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"os"
"golang.org/x/crypto/bcrypt"
...
...
@@ -145,7 +146,8 @@ func (s *Storage) UnmarshalJSON(b []byte) error {
storageConfig
:=
f
()
if
len
(
store
.
Config
)
!=
0
{
if
err
:=
json
.
Unmarshal
([]
byte
(
store
.
Config
),
storageConfig
);
err
!=
nil
{
data
:=
[]
byte
(
os
.
ExpandEnv
(
string
(
store
.
Config
)))
if
err
:=
json
.
Unmarshal
(
data
,
storageConfig
);
err
!=
nil
{
return
fmt
.
Errorf
(
"parse storace config: %v"
,
err
)
}
}
...
...
@@ -199,7 +201,8 @@ func (c *Connector) UnmarshalJSON(b []byte) error {
connConfig
:=
f
()
if
len
(
conn
.
Config
)
!=
0
{
if
err
:=
json
.
Unmarshal
([]
byte
(
conn
.
Config
),
connConfig
);
err
!=
nil
{
data
:=
[]
byte
(
os
.
ExpandEnv
(
string
(
conn
.
Config
)))
if
err
:=
json
.
Unmarshal
(
data
,
connConfig
);
err
!=
nil
{
return
fmt
.
Errorf
(
"parse connector config: %v"
,
err
)
}
}
...
...
cmd/dex/config_test.go
View file @
96fb0733
...
...
@@ -39,9 +39,8 @@ connectors:
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
clientID: foo
clientSecret: bar
redirectURI: http://127.0.0.1:5556/dex/callback/google
enablePasswordDB: true
...
...
@@ -96,8 +95,8 @@ expiry:
Name
:
"Google"
,
Config
:
&
oidc
.
Config
{
Issuer
:
"https://accounts.google.com"
,
ClientID
:
"
$GOOGLE_CLIENT_ID
"
,
ClientSecret
:
"
$GOOGLE_CLIENT_SECRET
"
,
ClientID
:
"
foo
"
,
ClientSecret
:
"
bar
"
,
RedirectURI
:
"http://127.0.0.1:5556/dex/callback/google"
,
},
},
...
...
cmd/dex/serve.go
View file @
96fb0733
...
...
@@ -9,7 +9,6 @@ import (
"log"
"net"
"net/http"
"os"
"time"
"github.com/ghodss/yaml"
...
...
@@ -48,7 +47,6 @@ 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
{
...
...
examples/config-dev.yaml
View file @
96fb0733
...
...
@@ -58,7 +58,7 @@ enablePasswordDB: true
staticPasswords
:
-
email
:
"
admin@example.com"
# bcrypt hash of the string "password"
hash
:
"
$2a$10$
33EMT0cVYVlPy6WAMCLsceLYjWhuHpbz5yuZxu/GAFj03J9Lytjuy
"
hash
:
"
$2a$10$
2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W
"
username
:
"
admin"
userID
:
"
08a8684b-db88-4b73-90a9-3cd1661f5466"
...
...
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