Skip to content
Snippets Groups Projects
Commit 92e3fbae authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

allow alternative configration structure with TAPROJ

parent 4be5a631
No related branches found
No related tags found
No related merge requests found
...@@ -67,7 +67,15 @@ sub _get_project_paths ...@@ -67,7 +67,15 @@ sub _get_project_paths
{ {
my $proj_name= shift; my $proj_name= shift;
my $proj_cfg_dir= join ('/', $ENV{'TABASE'}, 'projects', $proj_name); my $proj_cfg_dir;
if (exists ($ENV{'TAPROJ'}))
{
$proj_cfg_dir = join ('/', $ENV{'TAPROJ'}, $proj_name);
}
else
{
$proj_cfg_dir = join ('/', $ENV{'TABASE'}, 'projects', $proj_name);
}
my $proj_cfg_fnm= join ('/', $proj_cfg_dir, 'config.json'); my $proj_cfg_fnm= join ('/', $proj_cfg_dir, 'config.json');
return ($proj_cfg_dir, $proj_cfg_fnm); return ($proj_cfg_dir, $proj_cfg_fnm);
......
...@@ -32,9 +32,12 @@ ...@@ -32,9 +32,12 @@
=head1 DESCRIPTION =head1 DESCRIPTION
Updates a file catalog using md5cat library methods and registers the Updates a file catalog using md5cat library methods and registers the
files in the project's object registry. The environment variable TABASE files in the project's object registry. Either the environment variable
must point to the directory where the object registry's configuration TAPROJ or TABASE must point to the directory where the object registry's
is stored. configuration is stored. The configuration is named either
$ENV{'TAPROJ'}/<project>/config.json
or
$ENV{'TABASE'}/projects/<project>/config.json
=head1 BACKENDS =head1 BACKENDS
...@@ -122,14 +125,25 @@ while (my $arg= shift (@ARGV)) ...@@ -122,14 +125,25 @@ while (my $arg= shift (@ARGV))
print "debug level: $DEBUG\n"; print "debug level: $DEBUG\n";
&usage ('environment variable TABASE not set') unless (exists ($ENV{'TABASE'})); my $TAPROJ;
if (exists ($ENV{'TAPROJ'}))
{
$TAPROJ= $ENV{'TAPROJ'};
}
else
{
&usage ('environment variable TAPROJ or TABASE not set') unless (exists ($ENV{'TABASE'}));
$TAPROJ= join ('/', $ENV{'TABASE'}, 'projects');
}
# &usage ('no project specified') unless (defined ($project)); # &usage ('no project specified') unless (defined ($project));
unless (defined ($project)) unless (defined ($project))
{ {
print "no project specified; check these:\n"; print "no project specified; check these:\n";
system ("ls -ls \"$ENV{'TABASE'}/projects\""); system ('ls -ls "$TAPROJ"');
exit (2); exit (2);
} }
# &usage ('no store specified') unless (defined ($store)); # &usage ('no store specified') unless (defined ($store));
if ($op_mode eq 'edit') if ($op_mode eq 'edit')
...@@ -157,7 +171,8 @@ if ($op_mode eq 'refresh') ...@@ -157,7 +171,8 @@ if ($op_mode eq 'refresh')
my $store_cfg= $stores_p->{$store}; my $store_cfg= $stores_p->{$store};
unless (defined ($store_cfg)) unless (defined ($store_cfg))
{ {
print "no store config found for '$store', check these: ", Dumper ($stores_p); print "no store config found", (($store) ? " for '$store'" : ''), "; check these: ", join (', ', sort keys %$stores_p), "\n";
print "or use --edit to find out more\n";
exit (2); exit (2);
} }
...@@ -630,9 +645,13 @@ __END__ ...@@ -630,9 +645,13 @@ __END__
locate all the stores on a given machine, so there should be an option locate all the stores on a given machine, so there should be an option
that updates everything. that updates everything.
* specifing the store should be optional. * specifing the store should be optional.
* environment variable TAPROJ:
* add pod section
* allow command line option to specify alternative base directory name
* environment variable TABASE: * environment variable TABASE:
* add pod section * add pod section
* allow command line option to specify alternative base directory name * allow command line option to specify alternative base directory name
* maybe a better name than TAPROJ (or even TABASE) would make sense
=head2 misc =head2 misc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment