mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(): made config system check for generated css or javascript files and panic if there are none, also if there is a public_gen directory it will use that, even if static root is set to public
This commit is contained in:
parent
da832368f0
commit
0b5f40e66c
@ -354,6 +354,23 @@ func setHomePath(args *CommandLineArgs) {
|
||||
}
|
||||
}
|
||||
|
||||
func getStaticRootPath(configValue string) string {
|
||||
if configValue != "public" {
|
||||
return configValue
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path.Join(HomePath, configValue, "css")); err == nil {
|
||||
return configValue
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path.Join(HomePath, "public_gen", "css")); err == nil {
|
||||
return "public_gen"
|
||||
}
|
||||
|
||||
log.Fatal(3, "Failed to detect generated css or javascript files in static root (%s), have you executed default grunt task?", configValue)
|
||||
return ""
|
||||
}
|
||||
|
||||
func NewConfigContext(args *CommandLineArgs) {
|
||||
setHomePath(args)
|
||||
loadConfiguration(args)
|
||||
@ -373,7 +390,7 @@ 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(server.Key("static_root_path").String(), HomePath)
|
||||
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)
|
||||
|
@ -43,27 +43,27 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
grunt.registerTask('build-post-process', function() {
|
||||
grunt.config('copy.public_gen_to_dest', {
|
||||
grunt.config('copy.public_gen_to_temp', {
|
||||
expand: true,
|
||||
cwd: '<%= genDir %>',
|
||||
src: '**/*',
|
||||
dest: '<%= destDir %>/public/',
|
||||
dest: '<%= tempDir %>/public/',
|
||||
});
|
||||
grunt.config('copy.backend_bin', {
|
||||
cwd: 'bin',
|
||||
expand: true,
|
||||
src: ['*'],
|
||||
options: { mode: true},
|
||||
dest: '<%= destDir %>/bin/'
|
||||
dest: '<%= tempDir %>/bin/'
|
||||
});
|
||||
grunt.config('copy.backend_files', {
|
||||
expand: true,
|
||||
src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'],
|
||||
options: { mode: true},
|
||||
dest: '<%= destDir %>'
|
||||
dest: '<%= tempDir %>'
|
||||
});
|
||||
|
||||
grunt.task.run('copy:public_gen_to_dest');
|
||||
grunt.task.run('copy:public_gen_to_temp');
|
||||
grunt.task.run('copy:backend_bin');
|
||||
grunt.task.run('copy:backend_files');
|
||||
});
|
||||
|
@ -9,7 +9,7 @@ module.exports = function(config) {
|
||||
files : [
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= destDir %>',
|
||||
cwd: '<%= tempDir %>',
|
||||
src: ['**/*'],
|
||||
dest: '<%= pkg.name %>-<%= pkg.version %>/',
|
||||
},
|
||||
|
@ -74,7 +74,7 @@ module.exports = function(config,grunt) {
|
||||
];
|
||||
|
||||
var fs = require('fs');
|
||||
var panelPath = config.genDir+'/app/panels';
|
||||
var panelPath = config.srcDir + '/app/panels';
|
||||
|
||||
// create a module for each directory in public/app/panels/
|
||||
fs.readdirSync(panelPath).forEach(function (panelName) {
|
||||
|
Loading…
Reference in New Issue
Block a user