Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Environment Configuration

firecakes edited this page Aug 3, 2025 · 5 revisions

Before doing the final steps of getting your server working with HTTPS, you should learn all the configuration options available to you. The server reads configuration options from a file called .env that it expects in the same directory you placed your executable.

.env File

While in the same directory as the executable and code, run nano .env in the terminal. This opens up a text editor in your terminal which you can then use to add in configuration options. You can save the changes by the key combination Ctrl + X, and edit the file later by running nano .env again. Your executable will read from this file the next time it starts up.

Configuration Options

Below are the configuration options. Let's say you wanted to add a custom title to your server's feed. You would open the .env file and add this:

TITLE="My Custom Feed"

Or if you want the server to run on the HTTPS port, you do:

PORT=443

Here are all the following configuration options available to you. It's a lot!

  • TITLE: Title of your feed
  • SUBTITLE: Subtitle of your feed
  • AUTHOR: Who made the feed. Put your name or username here
  • CONTRIBUTORS: A comma-separated array of names you want to shoutout for helping with your feed
  • CATEGORIES: A comma-separated array of keywords or tags to categorize the type of content you post
  • HOST: The host name of the server. Defaults to localhost
  • PORT: The port the web server should run on. The default is 8000
  • HTTPS: Whether HTTPS is enabled. Defaults to false
  • JWT: Whether JWT is enabled. Required for using HTTPS or a domain other than localhost. Defaults to false
  • REFRESH_TOKEN_DAYS: How many days until another code needs to be generated on the server for authorization. Defaults to 120.
  • SERVER_CODE_LENGTH: Determines how many characters the generated server code is for initial authorization. Defaults to 256.
  • USE_BASIC_AUTH_CODE: If true, code is sent in console to be pasted in login form. If false (default), prints QR code to console for consumption by OTP app
  • HTTPS_CERTIFICATE_LOCATION: An SSL cert path used to enable HTTPS connections with the server. HTTPS_KEY_LOCATION also needed.
  • HTTPS_KEY_LOCATION: An SSL key path used to enable HTTPS connections with the server. HTTPS_CERTIFICATE_LOCATION also needed.
  • ENABLE_TRAFFIC_LOGS: Whether the server will start tracking IPs and HTML files accessed over time, viewable in the admin page. Defaults to false.
  • PROXY: Whether the server is going to run behind at least one proxy. Defaults to false.
  • PROXY_COUNT: How many proxies are handling traffic in series to the server. Defaults to 1 if proxy is enabled.
  • PROXY_REQ_IP: The IP address of the front-facing proxy server where requests come in. Defaults to 127.0.0.1
  • CLOUDFLARED: Whether CloudFlare is being used to direct traffic to the server. Defaults to false.
  • RATE_LIMIT_WINDOW: The window of time in which requests are being counted per IP. Defaults to 5 minutes.
  • RATE_LIMIT_MAX: The maximum number of requests allowed in the rate limit window. Defaults to 500 requests.
  • RATE_LIMIT_EXPIRE: For cleaning up client data in rate limiting algorithm. Defaults to 1 day for each IP.
  • RATE_LIMIT_DURATION: How long to ban clients who surpass the max rate limit. Defaults to 1 hour.
  • POSTS_PER_PAGE: Enables pagination if greater than 0 by showing this number of posts at a time on the unauthenticated home page. Defaults to 0.

You can add the configurations for TITLE, SUBTITLE, AUTHOR, CONTRIBUTORS, CATEGORIES now or later. The other options will be configured after you get your SSL certificate and key.

There is one special setting that cannot be changed through environment variables but changes how the project runs. If you go to /modules/xml.ts at the top of the file is const MAX_ENTRIES_PER_FEED_FILE = 50;. This is the default number of entries that can exist in each feed file created. This is a more advanced configuration, and it is something that should never be edited once the server is running, which is why it is hidden here. If for some reason 50 per feed file is unacceptable to you, you may edit the value here as long as you do it before running the server for the first time, or at least before making your first post.

Clone this wiki locally