feat: wrapper for pg_dumpall
This commit is contained in:
@@ -130,6 +130,7 @@
|
|||||||
prettify-log = pkgs.callPackage ./package/prettify-log/default.nix rust.commonArgs;
|
prettify-log = pkgs.callPackage ./package/prettify-log/default.nix rust.commonArgs;
|
||||||
pg-from = pkgs.callPackage ./package/postgres/pg-from/default.nix rust.commonArgs;
|
pg-from = pkgs.callPackage ./package/postgres/pg-from/default.nix rust.commonArgs;
|
||||||
pg-schema = pkgs.callPackage ./package/postgres/pg-schema/default.nix rust.commonArgs;
|
pg-schema = pkgs.callPackage ./package/postgres/pg-schema/default.nix rust.commonArgs;
|
||||||
|
wpg_dupmall = pkgs.callPackage ./package/postgres/wpg_dupmall.nix rust.commonArgs;
|
||||||
pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix rust.commonArgs;
|
pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix rust.commonArgs;
|
||||||
c-hectic = pkgs.callPackage ./package/c/hectic/default.nix {};
|
c-hectic = pkgs.callPackage ./package/c/hectic/default.nix {};
|
||||||
watch = pkgs.callPackage ./package/c/watch/default.nix {};
|
watch = pkgs.callPackage ./package/c/watch/default.nix {};
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ Parameters defining syntax for blocks controlling loops or nested structures.
|
|||||||
Finalizes the section declaration block.
|
Finalizes the section declaration block.
|
||||||
*Example:* `do ` | `:`
|
*Example:* `do ` | `:`
|
||||||
|
|
||||||
|
*Example*
|
||||||
|
|
||||||
*Section Example:*
|
*Section Example:*
|
||||||
```tpl
|
```tpl
|
||||||
{% for item in items do
|
{% for item in items do
|
||||||
@@ -140,4 +142,4 @@ Enables calling functions with arguments.
|
|||||||
- **Unclosed Tags:** Must return an error.
|
- **Unclosed Tags:** Must return an error.
|
||||||
- **Missing Fields/Functions/Templates:** Configurable to either return an error or warning.
|
- **Missing Fields/Functions/Templates:** Configurable to either return an error or warning.
|
||||||
- **Circular Includes:** Detect when possible.
|
- **Circular Includes:** Detect when possible.
|
||||||
- **No Shadowing:** Variables defined in section tags must not conflict with context variable names, otherwise, return an error.
|
- **No Shadowing:** Variables defined in section tags must not conflict with context variable names, otherwise, return an error.
|
||||||
|
|||||||
33
package/postgres/wpg_dupmall.nix
Normal file
33
package/postgres/wpg_dupmall.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Wrapper for pg_dumpall with url option
|
||||||
|
{ writeShellScriptBin, postgresql, ... }:
|
||||||
|
writeShellScriptBin "wpg_dupmall" /* */ ''
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--url=*)
|
||||||
|
url="''${1#--url=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--url)
|
||||||
|
url="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
args="$args $1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$url" ]; then
|
||||||
|
user=$(echo "$url" | sed -E 's|.*://([^:]+):.*@.*|\1|')
|
||||||
|
pass=$(echo "$url" | sed -E 's|.*://[^:]+:([^@]+)@.*|\1|')
|
||||||
|
host=$(echo "$url" | sed -E 's|.*@([^:/]+):.*|\1|')
|
||||||
|
port=$(echo "$url" | sed -E 's|.*:([0-9]+)/?.*|\1|')
|
||||||
|
export PGPASSWORD="$pass"
|
||||||
|
exec ${postgresql}/bin/pg_dumpall -h "$host" -p "$port" -U "$user" $args
|
||||||
|
else
|
||||||
|
exec ${postgresql}/bin/pg_dumpall $args
|
||||||
|
fi
|
||||||
|
''
|
||||||
Reference in New Issue
Block a user