Add ability to set database folder, and port.

This commit is contained in:
Ethan O'Brien
2024-07-03 11:49:52 -05:00
parent 6575ea1eb0
commit ec8aad5fde
4 changed files with 53 additions and 20 deletions

View File

@ -1,13 +1,14 @@
use actix_web::{HttpResponse, HttpRequest, http::header::{HeaderValue, ContentType, HeaderMap}};
use base64::{Engine as _, engine::general_purpose};
use std::collections::HashMap;
use std::env;
use sha1::Sha1;
use substring::Substring;
use json::{object, JsonValue};
use hmac::{Hmac, Mac};
use rusqlite::params;
use lazy_static::lazy_static;
use std::sync::atomic::Ordering;
use std::sync::atomic::AtomicBool;
use openssl::pkey::PKey;
use openssl::rsa::Rsa;
@ -332,8 +333,12 @@ pub fn migration_password_register(req: HttpRequest, body: String) -> HttpRespon
send(req, resp)
}
fn get_protocol() -> String {
if env::args().nth(1).unwrap_or_default() == *"https" {
lazy_static!{
pub static ref HTTPS: AtomicBool = AtomicBool::new(false);
}
pub fn get_protocol() -> String {
if HTTPS.load(Ordering::SeqCst) == true {
return String::from("https");
}
String::from("http")