diff --git a/.env.example b/.env.example deleted file mode 100644 index 5fca0004..00000000 --- a/.env.example +++ /dev/null @@ -1,107 +0,0 @@ -# MongoDB URI -MONGODB=mongodb://localhost -AUTUMN_MONGO_URI=mongodb://database -REDIS_URI=redis://localhost/ - -# URL to where the Revolt app is publicly accessible -REVOLT_APP_URL=http://local.revolt.chat:5000 - -# URL to where the API is publicly accessible -REVOLT_PUBLIC_URL=http://local.revolt.chat:8000 -VITE_API_URL=http://local.revolt.chat:8000 - -# URL to where the WebSocket server is publicly accessible -REVOLT_EXTERNAL_WS_URL=ws://local.revolt.chat:9000 - -# URL to where Autumn is publicly available -AUTUMN_PUBLIC_URL=http://local.revolt.chat:3000 - -# URL to where January is publicly available -JANUARY_PUBLIC_URL=http://local.revolt.chat:7000 - -# URL to where Vortex is publicly available -# VOSO_PUBLIC_URL=https://voso.revolt.chat - - -## -## hCaptcha Settings -## - -# If you are sure that you don't want to use hCaptcha, set to 1. -REVOLT_UNSAFE_NO_CAPTCHA=1 - -# hCaptcha API key -# REVOLT_HCAPTCHA_KEY=0x0000000000000000000000000000000000000000 - -# hCaptcha site key -# REVOLT_HCAPTCHA_SITEKEY=10000000-ffff-ffff-ffff-000000000001 - - -## -## Email Settings -## - -# If you are sure that you don't want to use email verification, set to 1. -REVOLT_UNSAFE_NO_EMAIL=1 - -# SMTP host -# REVOLT_SMTP_HOST=smtp.example.com - -# SMTP username -# REVOLT_SMTP_USERNAME=noreply@example.com - -# SMTP password -# REVOLT_SMTP_PASSWORD=CHANGEME - -# SMTP From header -# REVOLT_SMTP_FROM=Revolt - - -## -## Application Settings -## - -# Whether to enable staging only features -REVOLT_IS_STAGING=1 - -# Whether to only allow users to sign up if they have an invite code -REVOLT_INVITE_ONLY=0 - -# Maximum number of people that can be in a group chat -REVOLT_MAX_GROUP_SIZE=150 - -# VAPID keys for push notifications -# Generate using this guide: https://gitlab.insrt.uk/revolt/delta/-/wikis/vapid -# --> Please replace these keys before going into production! <-- -REVOLT_VAPID_PRIVATE_KEY=LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUJSUWpyTWxLRnBiVWhsUHpUbERvcEliYk1yeVNrNXpKYzVYVzIxSjJDS3hvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFWnkrQkg2TGJQZ2hEa3pEempXOG0rUXVPM3pCajRXT1phdkR6ZU00c0pqbmFwd1psTFE0WAp1ZDh2TzVodU94QWhMQlU3WWRldVovWHlBdFpWZmNyQi9BPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo= -REVOLT_VAPID_PUBLIC_KEY=BGcvgR-i2z4IQ5Mw841vJvkLjt8wY-FjmWrw83jOLCY52qcGZS0OF7nfLzuYbjsQISwVO2HXrmf18gLWVX3Kwfw= - - -## -## Vortex configuration -## - -# VOSO_MANAGE_TOKEN=CHANGEME - - -## -## Autumn configuration -## - -# S3 Region -AUTUMN_S3_REGION=minio - -# S3 Endpoint -AUTUMN_S3_ENDPOINT=http://minio:9000 - -# MinIO Root User -MINIO_ROOT_USER=minioautumn - -# MinIO Root Password -MINIO_ROOT_PASSWORD=minioautumn - -# AWS Access Key ID -AWS_ACCESS_KEY_ID=minioautumn - -# AWS Secret Key -AWS_SECRET_ACCESS_KEY=minioautumn diff --git a/README.md b/README.md index 73ef6cee..5ddb3ad7 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,7 @@ cargo build A default configuration `Revolt.toml` is present in this project that is suited for development. -If you'd like to change anything, create a `Revolt.overrides.toml` file to overwrite it. - -You may need to configure the legacy environment options: - -```bash -cp .env.example .env -``` +If you'd like to change anything, create a `Revolt.overrides.toml` file and specify relevant variables. Then continue: @@ -98,10 +92,13 @@ git clone --recursive https://github.com/revoltchat/revite cd revite yarn yarn build:deps +echo "VITE_API_URL=http://local.revolt.chat:14702" > .env.local yarn dev --port 14701 ``` -Then go to https://local.revolt.chat:14701 +Then go to http://local.revolt.chat:14701 to create an account/login. + +When signing up, go to http://localhost:14080 to find confirmation/password reset emails. ## Deployment Guide diff --git a/compose.yml b/compose.yml index 8e4f3ce7..1a78d35c 100644 --- a/compose.yml +++ b/compose.yml @@ -46,7 +46,7 @@ services: maildev: image: soulteary/maildev ports: - - "14025:8080" + - "14025:25" - "14080:8080" environment: MAILDEV_SMTP_PORT: 25 diff --git a/crates/core/config/src/lib.rs b/crates/core/config/src/lib.rs index f1d57051..dceba725 100644 --- a/crates/core/config/src/lib.rs +++ b/crates/core/config/src/lib.rs @@ -8,9 +8,17 @@ use serde::Deserialize; pub use sentry::capture_error; -#[cfg(not(debug_assertions))] -use std::env; +/// Paths to search for configuration +static CONFIG_SEARCH_PATHS: [&str; 3] = [ + // current working directory + "Revolt.toml", + // current working directory - overrides file + "Revolt.overrides.toml", + // root directory, for Docker containers + "/Revolt.toml", +]; +/// Configuration builder static CONFIG_BUILDER: Lazy> = Lazy::new(|| { RwLock::new({ let mut builder = Config::builder().add_source(File::from_str( @@ -23,18 +31,18 @@ static CONFIG_BUILDER: Lazy> = Lazy::new(|| { include_str!("../Revolt.test.toml"), FileFormat::Toml, )); - } else if std::path::Path::new("Revolt.toml").exists() { - builder = builder.add_source(File::new("Revolt.toml", FileFormat::Toml)); - } else if std::path::Path::new("/Revolt.toml").exists() { - builder = builder.add_source(File::new("/Revolt.toml", FileFormat::Toml)); + } + + for path in CONFIG_SEARCH_PATHS { + if std::path::Path::new(path).exists() { + builder = builder.add_source(File::new(path, FileFormat::Toml)); + } } builder.build().unwrap() }) }); -// https://gifbox.me/view/gT5mqxYKCZv-twilight-meow - #[derive(Deserialize, Debug, Clone)] pub struct Database { pub mongodb: String, @@ -259,6 +267,12 @@ pub async fn setup_logging(release: &'static str, dsn: String) -> Option