Merge branch 'main' of https://github.com/lemmynet/lemmy into main

This commit is contained in:
Dessalines 2020-11-01 21:26:36 -06:00
commit eab9123b86
3 changed files with 5 additions and 2 deletions

View file

@ -35,6 +35,8 @@
tls_enabled: true tls_enabled: true
# json web token for authorization between server and client # json web token for authorization between server and client
jwt_secret: "changeme" jwt_secret: "changeme"
# path to built documentation
docs_dir: "/app/documentation"
# address where pictrs is available # address where pictrs is available
pictrs_url: "http://pictrs:8080" pictrs_url: "http://pictrs:8080"
# rate limits for various user actions, by user ip # rate limits for various user actions, by user ip

View file

@ -1,6 +1,6 @@
use config::{Config, ConfigError, Environment, File}; use config::{Config, ConfigError, Environment, File};
use serde::Deserialize; use serde::Deserialize;
use std::{env, fs, io::Error, net::IpAddr, sync::RwLock}; use std::{env, fs, io::Error, net::IpAddr, path::PathBuf, sync::RwLock};
static CONFIG_FILE_DEFAULTS: &str = "config/defaults.hjson"; static CONFIG_FILE_DEFAULTS: &str = "config/defaults.hjson";
static CONFIG_FILE: &str = "config/config.hjson"; static CONFIG_FILE: &str = "config/config.hjson";
@ -13,6 +13,7 @@ pub struct Settings {
pub bind: IpAddr, pub bind: IpAddr,
pub port: u16, pub port: u16,
pub tls_enabled: bool, pub tls_enabled: bool,
pub docs_dir: PathBuf,
pub jwt_secret: String, pub jwt_secret: String,
pub pictrs_url: String, pub pictrs_url: String,
pub rate_limit: RateLimitConfig, pub rate_limit: RateLimitConfig,

View file

@ -84,7 +84,7 @@ async fn main() -> Result<(), LemmyError> {
.configure(|cfg| images::config(cfg, &rate_limiter)) .configure(|cfg| images::config(cfg, &rate_limiter))
.configure(nodeinfo::config) .configure(nodeinfo::config)
.configure(webfinger::config) .configure(webfinger::config)
.service(actix_files::Files::new("/docs", "/app/documentation")) .service(actix_files::Files::new("/docs", Settings::get().docs_dir))
}) })
.bind((settings.bind, settings.port))? .bind((settings.bind, settings.port))?
.run() .run()