Configuration
All configuration is done via JVM system properties (-D flags). No config files are required.
-Dserver.host
-Dserver.admin.port
-Dserver.redirect.port
-Dstorage.mode
-Dstorage.path
-Dstatistics.hot-window-hours
Server ports
| Property | Default | Description |
|---|---|---|
server.host | localhost | Bind address for the Admin API |
server.admin.port | 9090 | Admin API port |
server.redirect.port | 8081 | Public redirect port |
java -Dserver.host=0.0.0.0 \
-Dserver.admin.port=9090 \
-Dserver.redirect.port=8081 \
-jar urlshortener-server.jarSecurity note: Binding
server.host to 0.0.0.0 exposes the Admin API publicly. Use a reverse proxy with authentication in front of it.Storage mode
| Property | Values | Default |
|---|---|---|
storage.mode | memory, eclipsestore | memory |
storage.path | any directory path | /data |
In-memory
- No setup — the default mode.
- Everything lives in RAM and resets when the process stops.
- Ideal for development, testing and quick trials.
EclipseStore
- Durable storage that survives restarts.
- Binary serialization to disk — no SQL schema, no migration scripts.
- The choice for production deployments.
In-memory (default)
java -jar urlshortener-server.jarData is lost on restart. Suitable for development and testing.
EclipseStore (persistent)
java -Dstorage.mode=eclipsestore \
-Dstorage.path=/var/urlshortener/data \
-jar urlshortener-server.jarData is persisted to disk using EclipseStore’s binary serialization. No SQL schema, no migration scripts.
Statistics
| Property | Default | Description |
|---|---|---|
statistics.hot-window-hours | 24 | Hours kept in hot (hourly) buckets |
Alias policy
These are compile-time constants in AliasPolicy (can be overridden by subclassing):
| Setting | Value |
|---|---|
| Minimum length | 3 characters |
| Maximum length | 32 characters |
| Allowed chars | [A-Za-z0-9_-] |
| Reserved aliases | api, about, create, delete, list |
| Case sensitive | No (normalized to lowercase) |
Full example
java \
-Dserver.host=127.0.0.1 \
-Dserver.admin.port=9090 \
-Dserver.redirect.port=8081 \
-Dstorage.mode=eclipsestore \
-Dstorage.path=/opt/urlshortener/data \
-Dstatistics.hot-window-hours=48 \
-jar target/urlshortener-server-*.jarDocker (Community)
A community-maintained Dockerfile is available in the _tools/ directory:
cd _tools
docker build -t url-shortener .
docker run -p 8081:8081 -p 9090:9090 url-shortener