Currently does this for user nobody, to be able to use from the website.
We probably want to make this decission some other way.
-$dbh = DBI->connect("DBI:Pg:database=wanna-build") ||
- die "FATAL: Cannot open database: $DBI::errstr\n";
+my $schema_suffix = '';
+# TODO: Base this on something else, like an option that is passed.
+if ($real_user eq 'nobody') {
+ $dbh = DBI->connect("DBI:Pg:service=wanna-build") ||
+ die "FATAL: Cannot open database: $DBI::errstr\n";
+ $schema_suffix = '_public';
+}
+else
+{
+ $dbh = DBI->connect("DBI:Pg:service=wanna-build-privileged") ||
+ die "FATAL: Cannot open database: $DBI::errstr\n";
+}
# TODO: This shouldn't be needed, file a bug.
$dbh->{pg_server_prepare} = 0;
# TODO: This shouldn't be needed, file a bug.
$dbh->{pg_server_prepare} = 0;
- return '"' . $arch . '".packages';
+ return '"' . $arch . $schema_suffix . '".packages';
- return '"' . $arch . '".users';
+ return '"' . $arch . $schema_suffix . '".users';