Move configuration files under $site_path/etc
Most applications store their configuration files below some sort of etc directory within the application's "home place". We should do the same thing given that we have quite a few top level items in our $site_path directory (db, cache, logs, static, etc). Change-Id: Ia38ddab0174433acb59f271e33f32b5061121ea1 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -133,6 +133,7 @@ class GitWebServlet extends HttpServlet {
|
||||
_env.set("GIT_DIR", ".");
|
||||
_env.set("GITWEB_CONFIG", myconf.getAbsolutePath());
|
||||
|
||||
final File etc = new File(sitePath, "etc");
|
||||
final PrintWriter p = new PrintWriter(new FileWriter(myconf));
|
||||
try {
|
||||
p.print("# Autogenerated by Gerrit Code Review \n");
|
||||
@@ -142,11 +143,11 @@ class GitWebServlet extends HttpServlet {
|
||||
// We are mounted at the same level in the context as the main
|
||||
// UI, so we can include the same header and footer scheme.
|
||||
//
|
||||
final File hdr = new File(sitePath, "GerritSiteHeader.html");
|
||||
final File hdr = new File(etc, "GerritSiteHeader.html");
|
||||
if (hdr.isFile()) {
|
||||
p.print("$site_header = " + quoteForPerl(hdr) + ";\n");
|
||||
}
|
||||
final File ftr = new File(sitePath, "GerritSiteFooter.html");
|
||||
final File ftr = new File(etc, "GerritSiteFooter.html");
|
||||
if (ftr.isFile()) {
|
||||
p.print("$site_footer = " + quoteForPerl(ftr) + ";\n");
|
||||
}
|
||||
@@ -159,7 +160,7 @@ class GitWebServlet extends HttpServlet {
|
||||
p.print("$favicon = 'favicon.ico';\n");
|
||||
p.print("$logo = 'gitweb-logo.png';\n");
|
||||
p.print("@stylesheets = ('gitweb-default.css');\n");
|
||||
final File css = new File(sitePath, "GerritSite.css");
|
||||
final File css = new File(etc, "GerritSite.css");
|
||||
if (css.isFile()) {
|
||||
p.print("push @stylesheets, 'gitweb-site.css';\n");
|
||||
}
|
||||
@@ -209,7 +210,7 @@ class GitWebServlet extends HttpServlet {
|
||||
// If the administrator has created a site-specific gitweb_config,
|
||||
// load that before we perform any final overrides.
|
||||
//
|
||||
final File sitecfg = new File(sitePath, "gitweb_config.perl");
|
||||
final File sitecfg = new File(etc, "gitweb_config.perl");
|
||||
if (sitecfg.isFile()) {
|
||||
p.print("$GITWEB_CONFIG = " + quoteForPerl(sitecfg) + ";\n");
|
||||
p.print("if (-e $GITWEB_CONFIG) {\n");
|
||||
|
||||
Reference in New Issue
Block a user