AsthoBin is a simple website to share pieces of code with a URL, written in Rust (available on https://bin.asthowen.fr).
GPL-3.0 License
Start by cloning the repo:
git clone https://github.com/Asthowen/AsthoBin.git && cd AsthoBin
After that, create a database with the name you want, then edit .env
config file, for this please refer to configuration.
And finally, run Docker container (do not forget to change the two ports, one for AsthoBin and the other for your SQL database):
docker run -d \
--name=asthobin \
-p 8080:8080 \
-p 3306:3306 \
--restart unless-stopped \
--env-file .env \
asthowen/asthobin:latest
You can also use docker-compose with the docker/docker-compose.yml
file.
Start by cloning the repo:
git clone https://github.com/Asthowen/AsthoBin.git && cd AsthoBin
For the next step you need to have Rust and Cargo installed on your PC, for that follow the official documentation. You will also need pnpm.
Now compile a release:
cargo build --release
You can also enable https support by activating the https-support
feature (enabled by default in the Docker image):
cargo build --release --features https-support
Your executable will be in the target/release/
folder, it is named asthobin
.
To configure AsthoBin, just use the example configuration: .env.example
, you just have to rename it to .env
and complete it.
Key | Default | Description |
---|---|---|
HOST | 127.0.0.1 | The desired hostname to launch AsthoBin. |
PORT | 8080 | The desired port to launch AsthoBin. |
DATABASE_URL | Nothing (required) | The URL of your database. |
CORS_ORIGIN | * | CORS parameters. |
LOG_ON_ACCESS | false | Display a log when a user access to a file. |
LOG_ON_SAVE | false | Display a log when a user creates a file. |
RATELIMIT_BETWEEN_SAVE | 2 | Number of seconds between each file save. |
RATELIMIT_ALLOWED_BEFORE | 4 | Number of requests before blocking. |
ACTIX_WORKER_THREADS_NUMBER | 4 | The number of threads used by Actix. |
TZ | System value | The time zone of the logger, e.g: Europe/Paris . |
HTTP_PRIVATE_KEY | Nothing (optional) | The file path of SSL certificate private key. |
HTTP_CERTIFICATE_CHAIN | Nothing (optional) | The file path of SSL certificate chain. |
TLS_VERSIONS | Nothing (optional) | List of supported TLS protocols (tls1.2/tls1.3), e.g: tls1.2,tls1.3 . |
You must make sure that clippy (cargo clippy
) does not return any errors/warning. You must also run cargo fmt
.
openssl req -x509 -newkey rsa:4096 -nodes -keyout key.pem -out cert.pem -days 365 -subj '/CN=127.0.0.1'
This project uses semantic versioning, which has the format: MAJOR.MINOR.PATCH with:
MAJOR
version when you make incompatible API changes.MINOR
version when you add functionality in a backwards compatible manner.PATCH
version when you make backwards compatible bug fixes.