Skip to content

Commit

Permalink
Merge pull request #2 from geoadmin/0.3.6
Browse files Browse the repository at this point in the history
update doc
  • Loading branch information
benoitregamey authored Sep 25, 2024
2 parents bbfa13b + 26e5fb6 commit 11b9c62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
9 changes: 0 additions & 9 deletions bin/geocat_backup
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3

import argparse
import os
from geopycat.GeocatBackup import GeocatBackup

parser = argparse.ArgumentParser()
Expand All @@ -12,18 +11,10 @@ parser.add_argument("-m", "--metadata", action="store_false")
parser.add_argument("-u", "--users", action="store_false")
parser.add_argument("-g", "--groups", action="store_false")
parser.add_argument("-s", "--subtpl", action="store_false")
parser.add_argument("-db-user")
parser.add_argument("-db-password")

args = parser.parse_args()

if __name__ == "__main__":

if args.db_user is not None:
os.environ["DB_USERNAME"] = args.db_user

if args.db_password is not None:
os.environ["DB_PASSWORD"] = args.db_password

GeocatBackup(env=args.env, backup_dir=args.output_folder, catalogue=args.metadata,
users=args.users, groups=args.groups, subtemplates=args.subtpl)
18 changes: 3 additions & 15 deletions docs/cli_tools/Backup_geocat.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
geopycat provides a CLI script to generate backups of geocat.ch. In order to successfully
run this script, you should have admin rights and be able to connect to the PostgreSQL database of geocat.ch.

## Database connection
You can specify the username and password for connecting to the database in environment variables or in CLI parameters (see below).
If not, the script will prompt for credentials.

In a `.env` file
```bash
DB_USERNAME=username
DB_PASSWORD=password
```

## Running on UNIX system
``` bash
geocat_backup [-env [env]] [-o [o]] [-m] [-u] [-g] [-s] [-db-user [db username]] [-db-password [db password]]
geocat_backup [-env [env]] [-o [o]] [-m] [-u] [-g] [-s]
```
```
env: int or prod (optional, by default int)
Expand All @@ -22,14 +12,12 @@ o: output folder (optionaL, if not set, the backup will be saved in the curre
-u: do not backup users (optional)
-g: do not backup groups (optional)
-s: do not backup subtemplates (optional)
db username: database username (optional, see Database connection)
db password: database password (optional, see Database connection)
```
## Running on windows
```bash
python geocat_backup.py [-env [env]] [-o [o]] [-m] [-u] [-g] [-s] [-db-user [db username]] [-db-password [db password]]
python geocat_backup.py [-env [env]] [-o [o]] [-m] [-u] [-g] [-s]
```
## Running on windows (swisstopo)
```bash
& "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\scripts\geocat_backup.py" [-env] [-o] [-m] [-u] [-g] [-s] [-db-user] [-db-password]
& "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\scripts\geocat_backup.py" [-env] [-o] [-m] [-u] [-g] [-s]
```

0 comments on commit 11b9c62

Please sign in to comment.