RWS
Languages

Configure

How to configure RWS

Configuration

The rws can be started without any configuration. The following is the default config - the server will bind to IP 127.0.0.1 and port 7878, will spawn 200 threads, CORS requests are allowed.

The rws will try to read configuration from system environment variables first, then it will override configuration by reading it from file named rws.config.toml placed in the same directory where you execute rws, at last it will apply config provided via command-line arguments.

I personally prefer to use system environment variables, as once it is set correctly, they are hard to break accidentally by overwriting config, or each time providing command line arguments during restarts.

There may be a use case when you need to run more than one instance, in such a case config file per instance or command line configuration is an option.

Encryption

The rws is an HTTP server. This means if you are planning to use it somewhere else except the local machine you need to protect transferred data by using encryption.

There is a Rust TLS Server for handling HTTPS over TLS.

You can also use http-to-https-letsencrypt to obtain free certificate from Let's Encrypt.

Memory

As any other application, rws will allocate memory required to serve the request. For example if the client will make an HTTP GET for resource which has size more than free available memory on the running instance, rws will throw Out Of Memory error.

In such case valid options are:

To calculate how much memory is needed in worst case scenario, you can multiply the size of the biggest file to number of threads.

Additionally incoming request will consume some amount of memory as well as thread. Adding 1 mb per thread is good idea.