Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
8174b9f0
Commit
8174b9f0
authored
Sep 11, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tests): fixed failling backend test
parent
fb9e91e4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
20 deletions
+33
-20
main.go
+5
-1
pkg/setting/setting.go
+20
-11
pkg/setting/setting_test.go
+3
-1
public/app/controllers/signupCtrl.ts
+4
-6
public/app/core/filters/filters.ts
+1
-1
No files found.
main.go
View file @
8174b9f0
...
...
@@ -69,12 +69,16 @@ func main() {
}
func
initRuntime
()
{
setting
.
NewConfigContext
(
&
setting
.
CommandLineArgs
{
err
:=
setting
.
NewConfigContext
(
&
setting
.
CommandLineArgs
{
Config
:
*
configFile
,
HomePath
:
*
homePath
,
Args
:
flag
.
Args
(),
})
if
err
!=
nil
{
log
.
Fatal
(
3
,
err
.
Error
())
}
log
.
Info
(
"Starting Grafana"
)
log
.
Info
(
"Version: %v, Commit: %v, Build date: %v"
,
setting
.
BuildVersion
,
setting
.
BuildCommit
,
time
.
Unix
(
setting
.
BuildStamp
,
0
))
setting
.
LogConfigurationInfo
()
...
...
pkg/setting/setting.go
View file @
8174b9f0
...
...
@@ -6,6 +6,7 @@ package setting
import
(
"bytes"
"encoding/json"
"errors"
"fmt"
"net/url"
"os"
...
...
@@ -355,24 +356,26 @@ func setHomePath(args *CommandLineArgs) {
}
}
func
getStaticRootPath
(
configValue
string
)
string
{
if
configValue
!=
"public"
{
return
configValue
var
skipStaticRootValidation
bool
=
false
func
validateStaticRootPath
()
error
{
if
skipStaticRootValidation
{
return
nil
}
if
_
,
err
:=
os
.
Stat
(
path
.
Join
(
HomePath
,
configValue
,
"css"
));
err
==
nil
{
return
configValue
if
_
,
err
:=
os
.
Stat
(
path
.
Join
(
StaticRootPath
,
"css"
));
err
==
nil
{
return
nil
}
if
_
,
err
:=
os
.
Stat
(
path
.
Join
(
HomePath
,
"public_gen"
,
"css"
));
err
==
nil
{
return
"public_gen"
if
_
,
err
:=
os
.
Stat
(
StaticRootPath
+
"_gen/css"
);
err
==
nil
{
StaticRootPath
=
StaticRootPath
+
"_gen"
return
nil
}
log
.
Fatal
(
3
,
"Failed to detect generated css or javascript files in static root (%s), have you executed default grunt task?"
,
configValue
)
return
""
return
errors
.
New
(
"Failed to detect generated css or javascript files in static root (%s), have you executed default grunt task?"
)
}
func
NewConfigContext
(
args
*
CommandLineArgs
)
{
func
NewConfigContext
(
args
*
CommandLineArgs
)
error
{
setHomePath
(
args
)
loadConfiguration
(
args
)
...
...
@@ -391,10 +394,14 @@ func NewConfigContext(args *CommandLineArgs) {
Domain
=
server
.
Key
(
"domain"
)
.
MustString
(
"localhost"
)
HttpAddr
=
server
.
Key
(
"http_addr"
)
.
MustString
(
"0.0.0.0"
)
HttpPort
=
server
.
Key
(
"http_port"
)
.
MustString
(
"3000"
)
StaticRootPath
=
makeAbsolute
(
getStaticRootPath
(
server
.
Key
(
"static_root_path"
)
.
String
()),
HomePath
)
RouterLogging
=
server
.
Key
(
"router_logging"
)
.
MustBool
(
false
)
EnableGzip
=
server
.
Key
(
"enable_gzip"
)
.
MustBool
(
false
)
EnforceDomain
=
server
.
Key
(
"enforce_domain"
)
.
MustBool
(
false
)
StaticRootPath
=
makeAbsolute
(
server
.
Key
(
"static_root_path"
)
.
String
(),
HomePath
)
if
err
:=
validateStaticRootPath
();
err
!=
nil
{
return
err
}
// read security settings
security
:=
Cfg
.
Section
(
"security"
)
...
...
@@ -455,6 +462,8 @@ func NewConfigContext(args *CommandLineArgs) {
if
VerifyEmailEnabled
&&
!
Smtp
.
Enabled
{
log
.
Warn
(
"require_email_validation is enabled but smpt is disabled"
)
}
return
nil
}
func
readSessionConfig
()
{
...
...
pkg/setting/setting_test.go
View file @
8174b9f0
...
...
@@ -11,9 +11,11 @@ import (
func
TestLoadingSettings
(
t
*
testing
.
T
)
{
Convey
(
"Testing loading settings from ini file"
,
t
,
func
()
{
skipStaticRootValidation
=
true
Convey
(
"Given the default ini files"
,
func
()
{
NewConfigContext
(
&
CommandLineArgs
{
HomePath
:
"../../"
})
err
:=
NewConfigContext
(
&
CommandLineArgs
{
HomePath
:
"../../"
})
So
(
err
,
ShouldBeNil
)
So
(
AdminUser
,
ShouldEqual
,
"admin"
)
})
...
...
public/app/controllers/signupCtrl.ts
View file @
8174b9f0
///<reference path="../headers/require/require.d.ts" />
///<reference path="../headers/angularjs/angularjs.d.ts" />
///<amd-dependency path="angular"/>
///<amd-dependency path="config"/>
///<reference path="../headers/common.d.ts" />
///<amd-dependency path="config" name="config" />
var
angular
=
require
(
'angular'
);
var
config
=
require
(
'config'
)
;
import
angular
=
require
(
'angular'
);
declare
var
config
:
any
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
...
...
public/app/core/filters/filters.ts
View file @
8174b9f0
///<reference path="../../headers/common.d.ts" />
//
import
angular
=
require
(
'angular'
);
import
jquery
=
require
(
'jquery'
);
import
moment
=
require
(
'moment'
);
...
...
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