Skip to content

Commit e4e6858

Browse files
committed
Merge branch 'next' for v1.9
2 parents 0a0d821 + 7ae7492 commit e4e6858

File tree

21 files changed

+325
-88
lines changed

21 files changed

+325
-88
lines changed

.github/workflows/docker-publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
password: ${{ secrets.GITHUB_TOKEN }}
4141
-
4242
name: Build and push
43-
uses: docker/build-push-action@v3
43+
uses: docker/build-push-action@v4
4444
with:
4545
context: .
4646
platforms: linux/amd64,linux/arm64
@@ -49,4 +49,3 @@ jobs:
4949
labels: ${{ steps.meta.outputs.labels }}
5050
cache-from: type=gha
5151
cache-to: type=gha,mode=max
52-

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.9.0] - 2023-02-16
8+
### Added
9+
- #27; :construction: Experimental S3 storage support
10+
- Add ability to hide ascii art boot message
11+
### Changed
12+
- #70; Long ID only adjustable through config value
13+
- Bump deps
14+
715
## [1.8.0] - 2022-12-21
816
### Added
917
- Ensure Redis can be reached on app launch

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ FROM python:${PYTHON_VERSION}-alpine
3434

3535
EXPOSE 8000
3636
ENV PATH="/app/.venv/bin:$PATH"
37-
ENV PASTE_ROOT="/app/data"
37+
ENV STORAGE__DISK__PASTE_ROOT="/app/data"
3838

3939
COPY --from=build-content --link /app /app
4040

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ A fast and minimal paste bin, written in Python using Quart.
1717
- No JavaScript needed
1818
- Uses minimal resources
1919
- REST API
20-
- No Database needed, everything stored as flat-files
20+
- Pick your file system
21+
- Custom flat-file system
22+
- :construction: S3 objects
2123
- Caching (Internal & Redis)
2224
- Lightweight Docker image (uses Alpine Linux)
2325

@@ -43,7 +45,7 @@ This is a simple script allowing the creation of pastes from the command-line. Y
4345
The name was chosen not because the project is written badly, but because you use it so fast without a care in the world and "Fast Paste" was already taken!
4446

4547
## License
46-
This project is Copyright (c) 2022 Leo Spratt, licences shown below:
48+
This project is Copyright (c) 2023 Leo Spratt, licences shown below:
4749

4850
Code
4951

docs/assets/openapi.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi: 3.0.0
1+
openapi: 3.1.0
22
info:
33
title: Hasty Paste API
44
description: "A fast and minimal paste bin, written in Python using Quart."
@@ -102,9 +102,6 @@ components:
102102
lexer_name:
103103
type: string
104104
example: python
105-
long_id:
106-
type: boolean
107-
default: false
108105
title:
109106
type: string
110107
Paste:
@@ -125,9 +122,6 @@ components:
125122
lexer_name:
126123
type: string
127124
example: python
128-
long_id:
129-
type: boolean
130-
default: false
131125
title:
132126
type: string
133127
version:

docs/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ It is a place to quickly paste some text and share it. Mostly used for sharing d
1414
- No JavaScript needed
1515
- Uses minimal resources
1616
- REST API
17-
- No Database needed, everything stored as flat-files
17+
- Pick your file system
18+
- Custom flat-file system
19+
- :construction: S3 objects
1820
- Caching (Internal & Redis)
1921
- Lightweight Docker image (uses Alpine Linux)
2022

docs/install.md

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,49 @@ Please read these notes before continuing.
1111
- A HTTPS connection at endpoint is required for the "Copy Share Link" button
1212
- Use HTTPS otherwise paste links are exposed to man-in-the-middle attacks
1313
- If you have a high amount of clients, use Redis caching and set `WORKERS` to match the physical cpu cores
14+
- If using S3 the bucket should already be created with read/write access
15+
- S3 currently has been tested with [MinIO](https://min.io/) (can self-host)
1416

1517
## Configuration
1618
All configs shown here should be given as environment variables.
1719

18-
| Name | Description | Default | Docker Default |
19-
| :------------------------------- | :----------------------------------------------------------------- | :------------ | :------------- |
20-
| PASTE_ROOT | Where the paste flat file system will be kept | | /app/data |
21-
| TIME_ZONE | The time-zone where your clients are (used in web UI) | Europe/London | Europe/London |
22-
| NEW_AT_INDEX | Index page displays new paste page instead | False | False |
23-
| ENABLE_PUBLIC_LIST | Whether to enable public access for listing pastes | False | False |
24-
| | | | |
25-
| UI_DEFAULT__USE_LONG_ID | Setting this to "True" or "False" hides the long id checkbox in UI | False | False |
26-
| UI_DEFAULT__EXPIRE_TIME__ENABLE | Enable a default expire time in web ui | False | False |
27-
| UI_DEFAULT__EXPIRE_TIME__MINUTES | Default minutes in ui for expiry if enabled | 0 | 0 |
28-
| UI_DEFAULT__EXPIRE_TIME__HOURS | Default hours in ui for expiry if enabled | 1 | 1 |
29-
| UI_DEFAULT__EXPIRE_TIME__DAYS | Default days in ui for expiry if enabled | 0 | 0 |
30-
| | | | |
31-
| CACHE__ENABLE | Whether to enable caching of any type | True | True |
32-
| CACHE__INTERNAL_MAX_SIZE | The max size of the internal cache (<=0 to disable) | 4 | 4 |
33-
| CACHE__REDIS_URI | Use redis for caching | - | - |
34-
| | | | |
35-
| BRANDING__TITLE | Customise the app title | - | - |
36-
| BRANDING__DESCRIPTION | Customise the app description | - | - |
37-
| BRANDING__ICON | Customise the app icon, provide as absolute filepath | - | - |
38-
| BRANDING__FAVICON | Customise the app favicon, provide as absolute filepath | - | - |
39-
| BRANDING__CSS_FILE | Customise the site theme, using a provided css file | - | - |
40-
| BRANDING__HIDE_VERSION | Hide the app version number | False | False |
41-
| | | | |
42-
| MAX_BODY_SIZE | The max body size, given in bytes | 2000000 | 2000000 |
43-
| LOG_LEVEL | What log level to use | "WARNING" | "WARNING" |
44-
| | | | |
45-
| WORKERS | Number of separate processes to spawn | (Docker Only) | 1 |
46-
| CERT_FILE | SSL certificate file path (public) | (Docker Only) | - |
47-
| KEY_FILE | SSL key file path (private) | (Docker Only) | - |
20+
| Name | Description | Default | Docker Default |
21+
| :------------------------------- | :------------------------------------------------------ | :------------ | :------------- |
22+
| TIME_ZONE | The time-zone where your clients are (used in web UI) | Europe/London | Europe/London |
23+
| NEW_AT_INDEX | Index page displays new paste page instead | False | False |
24+
| ENABLE_PUBLIC_LIST | Whether to enable public access for listing pastes | False | False |
25+
| USE_LONG_ID | When "True" pastes will use a longer id | False | False |
26+
| | | | |
27+
| UI_DEFAULT__EXPIRE_TIME__ENABLE | Enable a default expire time in web ui | False | False |
28+
| UI_DEFAULT__EXPIRE_TIME__MINUTES | Default minutes in ui for expiry if enabled | 0 | 0 |
29+
| UI_DEFAULT__EXPIRE_TIME__HOURS | Default hours in ui for expiry if enabled | 1 | 1 |
30+
| UI_DEFAULT__EXPIRE_TIME__DAYS | Default days in ui for expiry if enabled | 0 | 0 |
31+
| | | | |
32+
| STORAGE__TYPE | What storage type to use (DISK, S3) | DISK | DISK |
33+
| STORAGE__DISK__PASTE_ROOT | Where the paste flat file system will be kept | - | /app/data |
34+
| STORAGE__S3__ENDPOINT_URL | Use a different endpoint other than AWS | - | - |
35+
| STORAGE__S3__ACCESS_KEY_ID | Access key ID | - | - |
36+
| STORAGE__S3__SECRET_ACCESS_KEY | Access key secret | - | - |
37+
| STORAGE__S3__BUCKET_NAME | Bucket name to store pastes (should already be created) | - | - |
38+
| | | | |
39+
| CACHE__ENABLE | Whether to enable caching of any type | True | True |
40+
| CACHE__INTERNAL_MAX_SIZE | The max size of the internal cache (<=0 to disable) | 4 | 4 |
41+
| CACHE__REDIS_URI | Use redis for caching | - | - |
42+
| | | | |
43+
| BRANDING__TITLE | Customise the app title | - | - |
44+
| BRANDING__DESCRIPTION | Customise the app description | - | - |
45+
| BRANDING__ICON | Customise the app icon, provide as absolute filepath | - | - |
46+
| BRANDING__FAVICON | Customise the app favicon, provide as absolute filepath | - | - |
47+
| BRANDING__CSS_FILE | Customise the site theme, using a provided css file | - | - |
48+
| BRANDING__HIDE_VERSION | Hide the app version number | False | False |
49+
| | | | |
50+
| MAX_BODY_SIZE | The max body size, given in bytes | 2000000 | 2000000 |
51+
| LOG_LEVEL | What log level to use | "WARNING" | "WARNING" |
52+
| HIDE_BOOT_MESSAGE | Hide the ascii art boot message | False | False |
53+
| | | | |
54+
| WORKERS | Number of separate processes to spawn | (Docker Only) | 1 |
55+
| CERT_FILE | SSL certificate file path (public) | (Docker Only) | - |
56+
| KEY_FILE | SSL key file path (private) | (Docker Only) | - |
4857

4958
> Default values indicated with '-' are not required
5059
@@ -131,6 +140,27 @@ volumes:
131140
data:
132141
```
133142
143+
### With S3
144+
145+
```yml
146+
version: "3"
147+
148+
services:
149+
paste-bin:
150+
container_name: paste-bin
151+
image: ghcr.io/enchant97/hasty-paste:1
152+
restart: unless-stopped
153+
ports:
154+
- 8000:8000
155+
environment:
156+
- "TIME_ZONE=Europe/London"
157+
- "STORAGE__TYPE=S3"
158+
- "STORAGE__S3__BUCKET_NAME="hasty-paste"
159+
- "STORAGE__S3__ACCESS_KEY_ID=< key id here >"
160+
- "STORAGE__S3__SECRET_ACCESS_KEY=< secret access key here >"
161+
162+
```
163+
134164
## Without Docker
135165
This will assume the supported Python version is installed and accessible.
136166

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ site_name: Hasty Paste
22
site_url: https://enchantedcode.co.uk/hasty-paste/
33
repo_url: https://github.com/enchant97/hasty-paste
44
use_directory_urls: false
5-
copyright: Copyright © 2022 Leo Spratt under FDLv1.3-or-later
5+
copyright: Copyright © 2023 Leo Spratt under FDLv1.3-or-later
66
theme:
77
name: material
88
palette:

paste_bin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.8.0"
1+
__version__ = "1.9.0"

paste_bin/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ async def command_cleanup(self, args):
9999

100100

101101
async def main():
102-
paste_root = os.environ.get("PASTE_ROOT")
102+
paste_root = os.environ.get("STORAGE__DISK__PASTE_ROOT")
103103

104104
if not paste_root:
105-
sys.exit("PASTE_ROOT has not been set")
105+
sys.exit("STORAGE__DISK__PASTE_ROOT has not been set")
106106

107107
paste_root = Path(paste_root)
108108
paste_root.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)