···19use std::time::Duration;
20use std::{env, net::SocketAddr};
21use tower_governor::GovernorLayer;
22-use tower_governor::governor::{GovernorConfig, GovernorConfigBuilder};
23use tower_http::compression::CompressionLayer;
24use tower_http::cors::{Any, CorsLayer};
25use tracing::log;
···97 "Error loading pds.env file (ignore if you loaded your variables in the environment somehow else): {e}"
98 );
99 }
100- let pds_root = env::var("PDS_DATA_DIRECTORY")?;
00101 let account_db_url = format!("{pds_root}/account.sqlite");
102103 let account_options = SqliteConnectOptions::new()
···19use std::time::Duration;
20use std::{env, net::SocketAddr};
21use tower_governor::GovernorLayer;
22+use tower_governor::governor::GovernorConfigBuilder;
23use tower_http::compression::CompressionLayer;
24use tower_http::cors::{Any, CorsLayer};
25use tracing::log;
···97 "Error loading pds.env file (ignore if you loaded your variables in the environment somehow else): {e}"
98 );
99 }
100+101+ let pds_root =
102+ env::var("PDS_DATA_DIRECTORY").expect("PDS_DATA_DIRECTORY is not set in your pds.env file");
103 let account_db_url = format!("{pds_root}/account.sqlite");
104105 let account_options = SqliteConnectOptions::new()
-2
src/middleware.rs
···1use crate::helpers::json_error_response;
2use axum::extract::Request;
3-use axum::http::header::AUTHORIZATION;
4use axum::http::{HeaderMap, StatusCode};
5use axum::middleware::Next;
6use axum::response::IntoResponse;
···73 .expect("Error creating an error response");
74 }
75 let token = token.expect("Already checked for error,");
76- // Not going to worry about expiration since it still goes to the PDS
77 req.extensions_mut()
78 .insert(Did(Some(token.claims().custom.sub.clone())));
79 }
···10use axum::{Extension, Json, debug_handler, extract, extract::Request};
11use serde::{Deserialize, Serialize};
12use serde_json;
0013use tracing::log;
1415#[derive(Serialize, Deserialize, Debug, Clone)]
···287 State(state): State<AppState>,
288 mut req: Request,
289) -> Result<Response<Body>, StatusCode> {
290+ //TODO if I add the block of only accounts authenticated just take the body as json here and grab the lxm token. No middle ware is needed
291+292 let uri = format!(
293 "{}{}",
294 state.pds_base_url, "/xrpc/com.atproto.server.createAccount"