Skip to content

Commit 47856f9

Browse files
committed
docs(readme): add SQLite instructions
1 parent 628ed75 commit 47856f9

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

README.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Pastebins are a type of online content storage service where users can store pla
2525
- [x] Modern, JavaScript-free user interface
2626
- [x] Syntax highlighting for all the most popular languages and Raw text mode
2727
- [ ] Password-protected encrypted pastes
28-
- [ ] SQLite Support
28+
- [x] SQLite Support
2929
- [ ] Paste collections
3030
- [ ] Reader view mode (Markdown is formatted and word wrapping is enabled)
3131
- [ ] QR Codes
@@ -42,6 +42,7 @@ Pastebins are a type of online content storage service where users can store pla
4242
- [Using Docker](#using-docker)
4343
- [Manually](#manually)
4444
- [Environment Variables](#environment-variables)
45+
- [Database Connection URI](#database-connection-uri)
4546
- [Usage](#usage)
4647
- [On the Web](#on-the-web)
4748
- [CLI](#cli)
@@ -64,7 +65,8 @@ $ sudo docker run -d -p 80:9000 spacebinorg/spirit
6465

6566
#### Manually
6667

67-
> [!IMPORTANT] > **Requires: [Git](https://git-scm.com/downloads), [Go 1.22.4](https://go.dev/doc/install), [GNU Makefile](https://www.gnu.org/software/make/#download), and a [PostgreSQL](https://www.postgresql.org/download/) [server](https://m.do.co/c/beaf675c3e00).**
68+
> [!IMPORTANT]
69+
> **Requires: [Git](https://git-scm.com/downloads), [Go 1.22.4](https://go.dev/doc/install), [GNU Makefile](https://www.gnu.org/software/make/#download), and a SQLite database or [PostgreSQL](https://www.postgresql.org/download/) [server](https://m.do.co/c/beaf675c3e00).**
6870
6971
```sh
7072
# Clone the Github repository
@@ -75,37 +77,46 @@ $ cd spacebin
7577
$ make spirit
7678

7779
# Start Spacebin
78-
$ SPIRIT_CONNECTION_URI="<your PostgreSQL instance URI>" ./bin/spirit
80+
$ SPIRIT_CONNECTION_URI="sqlite://database.sqlite" ./bin/spirit # SQLite
81+
$ SPIRIT_CONNECTION_URI="postgres://<your PostgreSQL instance URI>" ./bin/spirit # PostgreSQL
7982

8083
# Success! Spacebin is now available at port 9000 on your machine.
8184
```
8285

8386
#### Environment Variables
8487

85-
| Variable Name | Type | Default | Description |
86-
| ----------------------- | --------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
87-
| `SPIRIT_HOST` | String | `0.0.0.0` | Host address to listen on |
88-
| `SPIRIT_PORT` | Int | `9000` | HTTP port to listen on |
89-
| `SPIRIT_RATELIMITER` | String | `200x5` | Requests allowed per second before the user is ratelimited |
90-
| `SPIRIT_CONNECTION_URI` | String | **Required** | [PostgreSQL Database URI String](https://stackoverflow.com/questions/3582552/what-is-the-format-for-the-postgresql-connection-string-url#20722229) |
91-
| `SPIRIT_HEADLESS` | Bool | `False` | Enables/disables the web interface |
92-
| `SPIRIT_ANALYTICS` | String | `""` | `<script>` tag for analytics (leave blank to disable) |
93-
| `SPIRIT_ID_LENGTH` | Int | `8` | Length for document IDs |
94-
| `SPIRIT_ID_TYPE` | `"key"` or `"phrase"` | `key` | Format of IDs: `key` is a random string of letters and [`phrase` is a combination of words](https://github.com/lukewhrit/phrase) |
95-
| `SPIRIT_MAX_SIZE` | Int | `400000` | Max allowed size of a document in bytes |
96-
| `SPIRIT_EXPIRATION_AGE` | Int64 | `720` | Amount of time to expire documents after |
97-
| `SPIRIT_DOCUMENTS` | []String | `[]` | List of any custom documents to serve |
88+
| Variable Name | Type | Default | Description |
89+
| ----------------------- | --------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
90+
| `SPIRIT_HOST` | String | `0.0.0.0` | Host address to listen on |
91+
| `SPIRIT_PORT` | Int | `9000` | HTTP port to listen on |
92+
| `SPIRIT_RATELIMITER` | String | `200x5` | Requests allowed per second before the user is ratelimited |
93+
| `SPIRIT_CONNECTION_URI` | String | **Required** | Database connection URI |
94+
| `SPIRIT_HEADLESS` | Bool | `False` | Enables/disables the web interface |
95+
| `SPIRIT_ANALYTICS` | String | `""` | `<script>` tag for analytics (leave blank to disable) |
96+
| `SPIRIT_ID_LENGTH` | Int | `8` | Length for document IDs |
97+
| `SPIRIT_ID_TYPE` | `"key"` or `"phrase"` | `key` | Format of IDs: `key` is a random string of letters and [`phrase` is a combination of words](https://github.com/lukewhrit/phrase) |
98+
| `SPIRIT_MAX_SIZE` | Int | `400000` | Max allowed size of a document in bytes |
99+
| `SPIRIT_EXPIRATION_AGE` | Int64 | `720` | Amount of time to expire documents after |
100+
| `SPIRIT_DOCUMENTS` | []String | `[]` | List of any custom documents to serve |
98101

99102
> [!WARNING]
100103
> Environment variables for Spacebin are prefixed with `SPIRIT_`. They will be updated to `SPACEBIN_` in the next major version.
101104
105+
##### Database Connection URI
106+
107+
Spacebin supports two database formats: **SQLite** and **Postgres**
108+
109+
- For SQLite, use either the scheme `file://` or `sqlite://` and a file name.
110+
- Example: `file://database.db`
111+
- For PostgreSQL, use [the standard PostgreSQL URI format](https://stackoverflow.com/questions/3582552/what-is-the-format-for-the-postgresql-connection-string-url#20722229).
112+
102113
### Usage
103114

104115
#### On the Web
105116

106117
To use Spacebin on the web, our team provides a web app. You can access the web app at **[spaceb.in](https://spaceb.in)**. You must use `https://spaceb.in/api` to access the API routes.
107118

108-
A version of spacebin that is built directly from the `develop` branch is also available at \*\*[staging.spaceb.in](https://staging.spaceb.in)
119+
A version of spacebin that is built directly from the `develop` branch is also available at [staging.spaceb.in](https://staging.spaceb.in).
109120

110121
#### CLI
111122

0 commit comments

Comments
 (0)