Compare commits

..

No commits in common. "5f3a9473ff3b77f5184cc9d1f1b35170a3bdcf6c" and "e2b183ddc664aedb9cab4a92e6ca30b86597a8e7" have entirely different histories.

4 changed files with 6 additions and 40 deletions

View File

@ -8,7 +8,6 @@ A modern web-based RSS feed reader built with Rust and Rocket. Features a clean,
- Organize feeds with categories
- Multi-user support with admin capabilities
## Installation
### Using Nix
@ -34,15 +33,6 @@ This project is packaged with Nix flakes. To install and run it:
nix run git+https://code.everydayimshuflin.com/greg/rss-reader -- --demo
```
The application requires a `SECRET_KEY` environment variable to be set in order
to run. This key is used for encrypting cookies and other security-related
functionality. This is the same secret key described in [Rocket's
documentation](https://rocket.rs/guide/v0.5/configuration/#secret-key).
You can generate a suitable secret key using OpenSSL:
```bash
export SECRET_KEY=$(openssl rand -base64 32)
```
### Development
To set up a development environment:
@ -53,17 +43,12 @@ To set up a development environment:
cd rss-reader
```
2. Generate a secret key and set it in your environment:
```bash
export SECRET_KEY=$(openssl rand -base64 32)
```
3. Enter the development shell:
2. Enter the development shell:
```bash
nix develop
```
4. Build and run the application from source:
3. Run the application:
```bash
# Run with a persistent database
cargo run -- -d rss-reader.db
@ -74,24 +59,10 @@ To set up a development environment:
The application will be available at `http://localhost:8000`.
### Running in Production
For production deployments, make sure to:
1. Generate a strong secret key:
```bash
openssl rand -base64 32
```
2. Set it permanently in your environment or service configuration:
```bash
export SECRET_KEY="your-generated-key"
```
3. Keep this key consistent across application restarts to maintain user sessions
4. Never share or commit this key to version control
### Demo Mode
When running in demo mode (using the `--demo` flag), the application will:
- Use an in-memory SQLite database that is cleared when the application stops
- Create two pre-configured users:
- Admin user: username `admin`, password `admin`
- Regular user: username `demo`, password `demo`
- Regular user: username `demo`, password `demo`

2
Rocket.toml Normal file
View File

@ -0,0 +1,2 @@
[default]
secret_key = "MHSePvm1msyOkYuJ7u+MtyJYCzgdHCS7QNvrk9ts+rI="

View File

@ -1,11 +1,6 @@
_default:
@just --list
export SECRET_KEY := "MHSePvm1msyOkYuJ7u+MtyJYCzgdHCS7QNvrk9ts+rI="
[doc("Run the reader locally in demo mode.")] # don't re-use this secret key
run-local-demo:
cargo run -- --demo
sqlx-prepare:
DATABASE_URL="sqlite:data.sqlite" cargo sqlx prepare

View File

@ -99,9 +99,7 @@ fn rocket() -> _ {
format!("sqlite:{}", database)
};
let figment = rocket::Config::figment()
.merge(("databases.rss_data.url", db_url))
.merge(("secret_key", std::env::var("SECRET_KEY").expect("SECRET_KEY environment variable must be set")));
let figment = rocket::Config::figment().merge(("databases.rss_data.url", db_url));
rocket::custom(figment)
.mount(