diff --git a/README.md b/README.md index 7829dd3..377e768 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,28 @@ cd /src orchestration must be from the console(?) * turn off VPNs if connection to docker is not working +## User management +Copy [example.user-groups.yaml](src/example.user-groups.yaml) into a new file and set the environment variable `USER_GROUPS_FILENAME` to that filename (defaults to `user-groups.yaml`). + +This file contains 2 parts user-groups specifications. Each user can archive URLs publicly, privately, or privately for a group so long as they are declared as part of that group. In the example bellow `email1` has 2 groups while `email3` has none. +```yaml +users: + email1@example.com: + - group1 + - group2 + email2@example.com: + - group2 + email3@example-no-group.com: +``` + +Auto-archiver orchestrator files configurations. For each archiving task an orchestrator is chosen, either from a specified group (if group-level visibility) or the first group the user is assigned to in the above file or the `default` orchestration file which is a required config. +```yaml +orchestrators: + group1: secrets/orchestration-group1.yaml + group2: secrets/orchestration-group2.yaml + default: secrets/orchestration-default:.yaml +``` + ## Database migrations check https://alembic.sqlalchemy.org/en/latest/tutorial.html#the-migration-environment diff --git a/src/.example.env b/src/.example.env index 08675e7..02df5c9 100644 --- a/src/.example.env +++ b/src/.example.env @@ -4,4 +4,5 @@ ALLOWED_EMAILS=email1,email2 ORCHESTRATION_CONFIG_DEFAULT=secrets/orchestration.yaml # optional # ORCHESTRATION_CONFIG_BELLINGCAT=secrets/orchestration-bcat.yaml -DATABASE_PATH="sqlite:///./auto-archiver.db" \ No newline at end of file +DATABASE_PATH="sqlite:///./auto-archiver.db" +USER_GROUPS_FILENAME=user-groups.yaml \ No newline at end of file diff --git a/src/example.user-groups.yaml b/src/example.user-groups.yaml index 0b6744c..1d5c440 100644 --- a/src/example.user-groups.yaml +++ b/src/example.user-groups.yaml @@ -4,4 +4,10 @@ users: - group2 email2@example.com: - group2 - email3@example-no-group.com: \ No newline at end of file + email3@example-no-group.com: + + +orchestrators: + group1: secrets/orchestration-group1.yaml + group2: secrets/orchestration-group2.yaml + default: secrets/orchestration-default:.yaml \ No newline at end of file diff --git a/src/main.py b/src/main.py index 8b7fc53..a202bde 100644 --- a/src/main.py +++ b/src/main.py @@ -21,7 +21,7 @@ load_dotenv() # Configuration ALLOWED_ORIGINS = os.environ.get("ALLOWED_ORIGINS", "chrome-extension://ondkcheoicfckabcnkdgbepofpjmjcmb,chrome-extension://ojcimmjndnlmmlgnjaeojoebaceokpdp").split(",") -VERSION = "0.3.1" +VERSION = "0.4.0" # min-version refers to the version of auto-archiver-extension on the webstore BREAKING_CHANGES = {"minVersion": "0.3.0", "message": "The latest update has breaking changes, please update the extension to the most recent version."} @@ -160,4 +160,5 @@ async def on_startup(): @repeat_every(seconds=60 * 60) # 1 hour async def on_startup(): db: Session = next(get_db()) - crud.upsert_user_groups(db, "user-groups.yaml") \ No newline at end of file + USER_GROUPS_FILENAME=os.environ.get("USER_GROUPS_FILENAME", "user-groups.yaml") + crud.upsert_user_groups(db, USER_GROUPS_FILENAME) \ No newline at end of file