Skip to content

Commit

Permalink
doc(README): Add include and exclude priority
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Riou <[email protected]>
  • Loading branch information
jouir committed Jan 19, 2023
1 parent eeedca8 commit 763359c
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,51 +65,55 @@ Print usage:
pgterminate -help
```

# Filtering users
# Filters

`pgterminate` is able to include or exclude users from being terminated.
`pgterminate` is able to include or exclude from being terminated:
- users
- databases

## Configuration

### List
Arguments `-include-user` or `-exclude-user` can be used multiple times for multiple users:

The following arguments can be used called multiple times:
- `-include-user`
- `-exclude-user`
- `-include-database`
- `-exclude-database`

Example:

```
pgterminate -include-user user1 -include-user user2
```
Or in configuration file:

Or in configuration file (mind the plural form):

```
include-users:
user1
user2
```
Same applies for `-exclude-user` (argument) and `exclude-users` (file).

### Regexes

Regexes can be configured:

```
pgterminate -include-users-regex "(user1|user2)"
```

Or in configuration file:

```
include-users-regex: "(user1|user2)"
```

Same applies for `-exclude-users-regex` (argument) and `exclude-users-regex` (file).

## Include users

When include users list or regex is set, `pgterminate` will focus on included users only. It could terminate excluded users if any. If you want to exclude users, use exclude options only.

## Exclude users

When exclude users list or regex is set and no include option is set, `pgterminate` will terminate all sessions except excluded users.

# Filtering databases
## Inclusion and exclusion priority

Similar to users, `pgterminate` is able to filter sessions by database. The same set of options are available if you replace `user` by `database` (ex: `-include-user` to `-include-database` and so on).
Include filters are applied before exclude filters. If a user or a database is
both in the include and exclude filters, the user or database will be ignored
by `pgterminate`.

# Listeners

Expand Down

0 comments on commit 763359c

Please sign in to comment.