11# SimpleLink
22
3- A very performant and light (2MB in memory) link shortener and tracker. Written in Rust and React and uses Postgres.
3+ A very performant and light (2MB in memory) link shortener and tracker. Written in Rust and React and uses Postgres or SQLite .
44
55![ MainView] ( readme_img/mainview.jpg )
66
@@ -10,38 +10,44 @@ A very performant and light (2MB in memory) link shortener and tracker. Written
1010
1111### From Docker:
1212
13- ``` Bash
13+ ``` bash
1414docker run -p 8080:8080 \
1515 -e JWT_SECRET=change-me-in-production \
16+ 17+ -e SIMPLELINK_PASS=your-secure-password \
1618 -v simplelink_data:/data \
1719 ghcr.io/waveringana/simplelink:v2
1820```
1921
20- Find the admin-setup-token pasted into the terminal output, or in admin-setup-token.txt in the container's root.
22+ ### Environment Variables
23+
24+ - ` JWT_SECRET ` : Required. Used for JWT token generation
25+ - ` SIMPLELINK_USER ` : Optional. If set along with SIMPLELINK_PASS, creates an admin user on first run
26+ - ` SIMPLELINK_PASS ` : Optional. Admin user password
27+ - ` DATABASE_URL ` : Optional. Postgres connection string. If not set, uses SQLite
28+ - ` INITIAL_LINKS ` : Optional. Semicolon-separated list of initial links in format "url,code;url2,code2"
29+ - ` SERVER_HOST ` : Optional. Default: "127.0.0.1"
30+ - ` SERVER_PORT ` : Optional. Default: "8080"
2131
22- This is needed to register with the frontend. (TODO, register admin account with ENV)
32+ If ` SIMPLELINK_USER ` and ` SIMPLELINK_PASS ` are not passed, an admin-setup-token is pasted to the console and as a text file in the project root.
2333
2434### From Docker Compose:
2535
26- Edit the docker-compose.yml file. It comes included with a postgressql db for use
36+ Edit the docker-compose.yml file. It comes included with a PostgreSQL db configuration.
2737
2838## Build
2939
3040### From Source
3141
3242First configure .env.example and save it to .env
3343
34- If DATABASE_URL is set, it will connect to a Postgres DB. If blank, it will use an sqlite db in /data
35-
3644``` bash
3745git clone https://github.com/waveringana/simplelink && cd simplelink
3846./build.sh
3947cargo run
4048```
4149
42- On an empty database, an admin-setup-token.txt is created as well as pasted into the terminal output. This is needed to make the admin account.
43-
44- Alternatively if you want a binary form
50+ Alternatively for a binary build:
4551
4652``` bash
4753./build.sh --binary
@@ -55,10 +61,20 @@ then check /target/release for the binary named `SimpleGit`
5561docker build -t simplelink .
5662docker run -p 8080:8080 \
5763 -e JWT_SECRET=change-me-in-production \
64+ 65+ -e SIMPLELINK_PASS=your-secure-password \
5866 -v simplelink_data:/data \
5967 simplelink
6068```
6169
6270### From Docker Compose
6371
6472Adjust the included docker-compose.yml to your liking; it includes a postgres config as well.
73+
74+ ## Features
75+
76+ - Support for both PostgreSQL and SQLite databases
77+ - Initial links can be configured via environment variables
78+ - Admin user can be created on first run via environment variables
79+ - Link click tracking and statistics
80+ - Lightweight and performant
0 commit comments