2021-09-06 15:07:04 +00:00
# excalidraw-storage-backend
2022-06-11 20:09:03 +02:00
Forked from https://gitlab.com/kiliandeca/excalidraw-storage-backend
2021-09-08 17:54:32 +02:00
This is a reimplementation of [excalidraw-json ](https://github.com/excalidraw/excalidraw-json ) suitable for self hosting you own instance of Excalidraw.
It can be used with [kiliandeca/excalidraw-fork ](https://gitlab.com/kiliandeca/excalidraw-fork )
[DockerHub kiliandeca/excalidraw-storage-backend ](https://hub.docker.com/r/kiliandeca/excalidraw-storage-backend )
2021-12-01 18:12:47 +01:00
Feature:
- Storing scenes: when you export as a link
- Storing rooms: when you create a live collaboration
- Storing images: when you export or do a live collaboration of a scene with images
It use Keyv as a simple K/V store so you can use the database of your choice.
2021-09-08 15:31:02 +02:00
## Environement Variables
2024-06-11 13:23:04 +02:00
| Name | Description | Default value |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `PORT` | Server listening port | 8080 |
| `GLOBAL_PREFIX` | API global prefix for every routes | `/api/v2` |
| `STORAGE_URI` | [Keyv ](https://github.com/jaredwray/keyv ) connection string, example: `redis://user:pass@localhost:6379` . Availabe Keyv storage adapter: redis, mongo, postgres and mysql | `""` (in memory **non-persistent** ) |
| `STORAGE_TTL` | Time to live for data | null |
| `LOG_LEVEL` | Log level (`debug` , `verbose` , `log` , `warn` , `error` ) | `warn` |
| `BODY_LIMIT` | Payload size limit for scenes or images | `50mb` |
| `ENABLE_POSTGRES_TTL_SERVICE` | Enabling the Postgres TTL Service will clean up expired items once a day. This will break if used with a non-postgres `STORAGE_URI` . | `false` |
2024-03-06 11:15:09 +01:00
### Env Variables for Postgres
2024-06-11 13:23:04 +02:00
2024-03-06 11:15:09 +01:00
For setting postgres pool variables, a few code adjustment have to be made in the `storage.service.ts` :
2024-06-11 13:23:04 +02:00
2024-03-06 11:15:09 +01:00
```typescript
const store = new (require('@keyv/postgres '))({
uri,
2024-06-11 13:23:04 +02:00
max: 1,
});
2024-03-06 11:15:09 +01:00
const keyv = new Keyv({
store,
ttl,
});
```