Spartan server written in Rust.
Small server that will cover all basic needs.
It supports:
- Serving static files
- Serving file lists
- CGI-like scripts(all input data will be send to stdin of process)
- Basic configuration
Log level always fetched via enviroment.
Use RUST_LOG
variable for setting log level(info, debug, trace etc).
There two ways of configuration of server:
- Via enviroment
- Via toml-file
- Nothing - will be used default configuration
Just setup next variables:
RUSTAN_HOST
(for exampleRUSTAN_HOST="127.0.0.1:3001" ./rustan
)RUSTAN_SERVER_ROOT
(for exampleRUSTAN_SERVER_ROOT="/var/spartan ./rustan"
)RUSTAN_MAX_UPLOAD_SIZE
(for exampleRUSTAN_MAX_UPLOAD_SIZE=1024
)
Entire command can look like this:
RUST_LOG=info RUSTAN_HOST="127.0.0.1:3001" RUSTAN_SERVER_ROOT="/var/spartan" RUSTAN_MAX_UPLOAD_SIZE=1 ./rustan
There example file settings.toml.example
that can be used as template.
When RustAn starting it looking for settings.toml
in current directory and in /etc/rustan/
.
Settings can be overrided via enviroment configuration.
To serve directory you should create .listfiles
file.
If it have some contents - it will be used as gemini header.
You'll need cargo tool.
It can be installed via rustup.
For development you can run it just via RUST_LOG=debug cargo run
.
For building release version use cargo build --release
. Compiled binary will be in target/release
directory.
- Add redirects support
- Handle directories without slashes on end
- Windows support(may be it will work out of the box, not tested)
- Maybe something else?
I've licensed project by Nihirash's Coffeeware License.
Please respect it - it isn't hard.