Project

General

Profile

1
#!/bin/bash
2

    
3
vegbien_dest_main ()
4
{
5
    local self="${BASH_SOURCE[0]}"
6
    local selfDir="$(dirname -- "$self")"
7
    
8
    # Was run without initial "."
9
    if test "${BASH_LINENO[1]}" = 0 -a "${BASH_ARGV[0]}" != "$self"; then
10
        echo "Usage: . $self (note initial \".\")"|fold -s >&2
11
        return 2
12
    fi
13
    
14
    : ${prefix=} ${version=public} ${public=$version}
15
    
16
    export version public \
17
    ${prefix}engine=PostgreSQL \
18
    ${prefix}host=localhost \
19
    ${prefix}user=bien \
20
    ${prefix}password="$(cat "$selfDir/../config/bien_password")" \
21
    ${prefix}database=vegbien \
22
    ${prefix}schemas="temp${public:+,$public,${public}_validations},TNRS,util,py_util"
23
    
24
    # Schema override for referring to a table in the $public schema
25
    local schemaVar=${prefix}schema tableVar=${prefix}table
26
    if test -n "${!schemaVar}" -a -n "${!tableVar}"; then
27
        local tableTable="${!tableVar#public.}"
28
        if test "$tableTable" != "${!tableVar}"; then # had prefix
29
            export $tableVar="$tableTable" $schemaVar="$public"
30
        fi
31
    fi
32
}
33
vegbien_dest_main "$@"
(81-81/86)