# Database settings

**Data → Database settings** holds the settings that belong to one project's section of the database: its own login, how long a statement may run, which network addresses may use its keys and tokens, the record of connections, and addresses held back from sign-in.

| You want to | Who can |
|---|---|
| See the settings | Any member |
| Change time limits, the connection record, or let an address back in | Owners and developers |
| Set the database password, or change which addresses are allowed | Owners |

Every change is on the project's [record](https://rezincore.com/docs/usage-and-logs.md#logs).

## The project's database login

> **Direct connections are not available yet.** The database is not reachable from the internet, so no Postgres client outside Rezin Core can connect, with this login or any other. Your application uses the [data API](https://rezincore.com/docs/database/data-api.md); you and your tools use the console, the [command-line tool](https://rezincore.com/docs/tools/cli.md) and the [connector](https://rezincore.com/docs/tools/connector.md).

A project can have a database login of its own, ready for the day direct connections are offered.

- **Make login and password** creates it. You type the project's name to confirm.
- The password is **shown once**. Rezin Core does not keep it: only the database holds it, as a hash.
- **Replace password** makes a new one. The old one stops at once and anything connected with it is cut off.
- The login reaches this project's section of the database and nothing else: not another project, not the platform's own tables, and it cannot make roles or databases.

Everything that reaches Rezin Core today, the API and the console, is HTTPS only.

## Time limits and connections

A project may be stricter than the server, never looser.

| Setting | What it limits | Range |
|---|---|---|
| Longest a statement may run in the SQL workspace and tools | The SQL workspace, the table editor, `rezin sql` and the connector's `run_sql` | 1 second up to the server's limit (30 seconds) |
| Longest a statement may run for your application | Statements the API runs for your application | 1 to 60 seconds. Empty uses the server's default |
| Statements your tools may run at once | Connections of the role the SQL workspace and tools use | 2 to 20 |

- Leave a time box empty to go back to the server's limit.
- A statement that runs too long is stopped and answers with an error; nothing it changed is kept.
- A new limit for the application applies as its connections are renewed, usually within a minute.
- The table under the form shows each role, what uses it and how many connections it has open now.

## Allowed network addresses

By default a project's keys and tokens are accepted from any address. An owner can restrict them to a list.

1. Add each address or range your servers and people use: one address (`203.0.113.7`), or a range (`203.0.113.0/24`, `2001:db8::/32`). A note helps you remember what each is. Up to 50.
2. Press **Restrict to the list**.

From then on a request from any other address is refused with `403 network_not_allowed`. That covers:

- The API with either project key, including [live updates](https://rezincore.com/docs/realtime.md) and [function](https://rezincore.com/docs/functions.md) calls.
- [Personal access tokens](https://rezincore.com/docs/tools/access-tokens.md): the command-line tool, the management API and [connected assistants](https://rezincore.com/docs/tools/connector.md).

Things to know:

- **The console is not affected.** You can always sign in and change the list.
- The page shows the address you are at, and whether it is in the list.
- The restriction cannot be switched on with nothing listed, and the last range cannot be removed while it is on. Switch it off first.
- A range that means "every address" is refused. To accept every address, switch the restriction off.
- Until you restrict, the list is kept but not applied.
- A change applies within about five seconds.
- Links to files in a **public bucket** and **signed links** are not keys and are not restricted by this.

## Record of connections

When this is ticked, the project's record gets a line each time a key or a token starts being used from an address: at most once an hour per key and address, not once per request. Each line has the address and which key or token it was.

A refused key or token is recorded whether or not this is on.

## Addresses held back from sign-in

An address that goes over the project's [sign-in limit](https://rezincore.com/docs/auth/settings.md#sessions-and-limits) is held back from the sign-in routes for 10 minutes and answers `429 too_many_requests`.

- It lifts by itself. The page lists each address, since when and until when.
- **Let back in** lifts one at once.
- Only signing in, signing up and provider sign-in are held back. People already signed in, and other addresses, are not affected.
- The list is kept in the database, so a restart of Rezin Core does not forget it.
