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
03033e5e
Commit
03033e5e
authored
Dec 17, 2016
by
rithu leena john
Committed by
GitHub
Dec 17, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #750 from rithujohn191/use-utc
server: use UTC timestamps in dex.
parents
c58dd948
135b7172
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
serve.go
cmd/dex/serve.go
+17
-4
No files found.
cmd/dex/serve.go
View file @
03033e5e
...
@@ -180,6 +180,9 @@ func serve(cmd *cobra.Command, args []string) error {
...
@@ -180,6 +180,9 @@ func serve(cmd *cobra.Command, args []string) error {
logger
.
Infof
(
"config skipping approval screen"
)
logger
.
Infof
(
"config skipping approval screen"
)
}
}
// explicitly convert to UTC.
now
:=
func
()
time
.
Time
{
return
time
.
Now
()
.
UTC
()
}
serverConfig
:=
server
.
Config
{
serverConfig
:=
server
.
Config
{
SupportedResponseTypes
:
c
.
OAuth2
.
ResponseTypes
,
SupportedResponseTypes
:
c
.
OAuth2
.
ResponseTypes
,
SkipApprovalScreen
:
c
.
OAuth2
.
SkipApprovalScreen
,
SkipApprovalScreen
:
c
.
OAuth2
.
SkipApprovalScreen
,
...
@@ -189,6 +192,7 @@ func serve(cmd *cobra.Command, args []string) error {
...
@@ -189,6 +192,7 @@ func serve(cmd *cobra.Command, args []string) error {
Web
:
c
.
Frontend
,
Web
:
c
.
Frontend
,
EnablePasswordDB
:
c
.
EnablePasswordDB
,
EnablePasswordDB
:
c
.
EnablePasswordDB
,
Logger
:
logger
,
Logger
:
logger
,
Now
:
now
,
}
}
if
c
.
Expiry
.
SigningKeys
!=
""
{
if
c
.
Expiry
.
SigningKeys
!=
""
{
signingKeys
,
err
:=
time
.
ParseDuration
(
c
.
Expiry
.
SigningKeys
)
signingKeys
,
err
:=
time
.
ParseDuration
(
c
.
Expiry
.
SigningKeys
)
...
@@ -251,6 +255,15 @@ var (
...
@@ -251,6 +255,15 @@ var (
logFormats
=
[]
string
{
"json"
,
"text"
}
logFormats
=
[]
string
{
"json"
,
"text"
}
)
)
type
utcFormatter
struct
{
f
logrus
.
Formatter
}
func
(
f
*
utcFormatter
)
Format
(
e
*
logrus
.
Entry
)
([]
byte
,
error
)
{
e
.
Time
=
e
.
Time
.
UTC
()
return
f
.
f
.
Format
(
e
)
}
func
newLogger
(
level
string
,
format
string
)
(
logrus
.
FieldLogger
,
error
)
{
func
newLogger
(
level
string
,
format
string
)
(
logrus
.
FieldLogger
,
error
)
{
var
logLevel
logrus
.
Level
var
logLevel
logrus
.
Level
switch
strings
.
ToLower
(
level
)
{
switch
strings
.
ToLower
(
level
)
{
...
@@ -264,19 +277,19 @@ func newLogger(level string, format string) (logrus.FieldLogger, error) {
...
@@ -264,19 +277,19 @@ func newLogger(level string, format string) (logrus.FieldLogger, error) {
return
nil
,
fmt
.
Errorf
(
"log level is not one of the supported values (%s): %s"
,
strings
.
Join
(
logLevels
,
", "
),
level
)
return
nil
,
fmt
.
Errorf
(
"log level is not one of the supported values (%s): %s"
,
strings
.
Join
(
logLevels
,
", "
),
level
)
}
}
var
formatter
logrus
.
Formatter
var
formatter
utc
Formatter
switch
strings
.
ToLower
(
format
)
{
switch
strings
.
ToLower
(
format
)
{
case
""
,
"text"
:
case
""
,
"text"
:
formatter
=
&
logrus
.
TextFormatter
{
DisableColors
:
true
}
formatter
.
f
=
&
logrus
.
TextFormatter
{
DisableColors
:
true
}
case
"json"
:
case
"json"
:
formatter
=
&
logrus
.
JSONFormatter
{}
formatter
.
f
=
&
logrus
.
JSONFormatter
{}
default
:
default
:
return
nil
,
fmt
.
Errorf
(
"log format is not one of the supported values (%s): %s"
,
strings
.
Join
(
logFormats
,
", "
),
format
)
return
nil
,
fmt
.
Errorf
(
"log format is not one of the supported values (%s): %s"
,
strings
.
Join
(
logFormats
,
", "
),
format
)
}
}
return
&
logrus
.
Logger
{
return
&
logrus
.
Logger
{
Out
:
os
.
Stderr
,
Out
:
os
.
Stderr
,
Formatter
:
formatter
,
Formatter
:
&
formatter
,
Level
:
logLevel
,
Level
:
logLevel
,
},
nil
},
nil
}
}
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