Lighting Fast Link Shortener
You can run wormholes from provided compose.yml
.
git clone --depth=1 git@github.com:noquark/wormholes.git
cd wormholes
# Change PostgresQL and Redis configuration
docker compose up -d
- GET
:5000/:id
- PUT
:5000/api/
- POST
:5000/api/:id
- GET
:5000/api/:id
- DELETE
:5000/api/:id
- GET
:5000/api/:id
PORT
- Application port. Default value is5000
.GEN_PORT
- Generator port. Default value is5001
Wormholes uses PostgreSQL and Redis. You can customize connection to these using environment variables as follows —
PostgreSQL
PG_URI
- This controls the URI for connecting to PostgreSQL. The default ispostgres://postgres:postgres@localhost:5432/postgres
.PG_MAX_CONN
- This controls the max connections for PostgreSQL. The default is5000
.
Redis
REDIS_URI
- THis controls the URI connecting to Redis and the default isredis://:redis@localhost:6379/0
.
Links are ingested in a batch to avoid excessive database connections. We can control it's behavior with following environment variables —
BATCH_SIZE
- This controls number of links ingested in a batch. The default value is10000
.
ID_SIZE
- This controls the size of generated IDs. The default value is7
.BLOOM_MAX
- This configures bloom-filters based on approx number of IDs to store. The default value is1000000
.BLOOM_ERROR
- This controls the rate of false positives in bloom filter and the default is0.0000001
.BUCKET_SIZE
- Inside generator, IDs to be used are stored in buckets. This controls the number of buckets to store IDs8
.BUCKET_CAP
- This controls the number of IDs to store in a single bucket which is100000
by default.
Feel free to open an issue or pull request.