From 6c38e30e9ae2ec206913e6e0eca5dc29abee7a27 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Tue, 5 Jan 2010 20:34:40 +0200 Subject: [PATCH] compile: support "include" definition Support config file including using: include "filename" If filename is not an absolute path, it is looked from the $GL_ADMINDIR/conf/ directory. For security reasons include is not allowed for fragments. Signed-off-by: Teemu Matilainen --- src/gl-compile-conf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gl-compile-conf b/src/gl-compile-conf index 2787893..b654e69 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -264,6 +264,16 @@ sub parse_conf_file $repo_config{$repo}{$key} = $value; } } + # include + elsif (/^include "(.+)"/) + { + my $file = $1; + $file = "$GL_ADMINDIR/conf/$file" unless $file =~ /^\//; + die "$WARN $fragment attempting to include configuration\n" if $fragment ne 'master'; + die "$ABRT included file not found: '$file'\n" unless -f $file; + + parse_conf_file($file, $fragment); + } # very simple syntax for the gitweb description of repo; one of: # reponame = "some description string" # reponame "owner name" = "some description string"