This commit is contained in:
jackyzy823 2023-11-01 16:18:43 +00:00 committed by GitHub
commit 2583c5b892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -100,9 +100,10 @@ $ cp nitter.example.conf nitter.conf
```
Set your hostname, port, HMAC key, https (must be correct for cookies), and
Redis info in `nitter.conf`. To run Redis, either run
`redis-server --daemonize yes`, or `systemctl enable --now redis` (or
redis-server depending on the distro). Run Nitter by executing `./nitter` or
Redis info in `nitter.conf` or Environment Variables in format of
`NITTER_SECTION_KEY=xxxx` in upper case (for example: NITTER_SERVER_HOSTNAME=nitter.net).
To run Redis, either run `redis-server --daemonize yes`, or `systemctl enable --now redis`
(or redis-server depending on the distro). Run Nitter by executing `./nitter` or
using the systemd service below. You should run Nitter behind a reverse proxy
such as [Nginx](https://github.com/zedeus/nitter/wiki/Nginx) or
[Apache](https://github.com/zedeus/nitter/wiki/Apache) for security and
@ -125,6 +126,13 @@ docker build -t nitter:latest .
docker run -v $(pwd)/nitter.conf:/src/nitter.conf -d --network host nitter:latest
```
or
```bash
docker build -t nitter:latest .
docker run -e NITTER_SERVER_ADDRESS=0.0.0.0 -e NITTER_SERVER_PORT=8080 -d --network host nitter:latest
```
Note: For ARM64, use this Dockerfile: [`Dockerfile.arm64`](https://github.com/zedeus/nitter/blob/master/Dockerfile.arm64).
A prebuilt Docker image is provided as well:

View File

@ -1,3 +1,5 @@
# Config can be set via Environment Variables in format of `NITTER_SECTION_KEY`.
# Environment Variables override nitter.conf.
[Server]
hostname = "nitter.net" # for generating links, change this to your own domain/ip
title = "nitter"

View File

@ -1,9 +1,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
import parsecfg except Config
import types, strutils
import types, strutils, std/os
proc get*[T](config: parseCfg.Config; section, key: string; default: T): T =
let val = config.getSectionValue(section, key)
let envKey = "NITTER_" & section.toUpperAscii & "_" & key.toUpperAscii
let envVal = getEnv(envKey)
let val = if envVal.len == 0: config.getSectionValue(section, key) else: envVal
if val.len == 0: return default
when T is int: parseInt(val)
@ -11,7 +13,7 @@ proc get*[T](config: parseCfg.Config; section, key: string; default: T): T =
elif T is string: val
proc getConfig*(path: string): (Config, parseCfg.Config) =
var cfg = loadConfig(path)
var cfg = try: loadConfig(path) except IOError: parseCfg.Config()
let conf = Config(
# Server