mirror of
https://github.com/mastodon/flodgatt
synced 2025-04-11 22:58:25 +02:00
Hotfix to correct typo and set default log level to warn
This commit is contained in:
parent
a67317b0a2
commit
00cf62cd09
11
src/.env
11
src/.env
@ -1,6 +1,11 @@
|
|||||||
# Uncomment any of the variables below to customize your enviornment
|
# Uncomment any of the variables below to customize your enviornment
|
||||||
|
|
||||||
#SERVER_ADDR=
|
|
||||||
#REDIS_ADDR=
|
|
||||||
#POSTGRES_ADDR=
|
#POSTGRES_ADDR=
|
||||||
CORS_ALLOWED_METHODS="GET OPTIONS"
|
#REDIS_ADDR=
|
||||||
|
#SERVER_ADDR=
|
||||||
|
#SSE_UPDATE_INTERVAL=
|
||||||
|
#WS_UPDATE_INTERVAL=
|
||||||
|
#REDIS_POLL_INTERVAL=
|
||||||
|
|
||||||
|
#Possible values for the log level are eror, warn, info, debug, trace
|
||||||
|
RUST_LOG=warn
|
@ -18,14 +18,19 @@ const DEFAULT_WS_UPDATE_INTERVAL: u64 = 100;
|
|||||||
const DEFAULT_REDIS_POLL_INTERVAL: u64 = 100;
|
const DEFAULT_REDIS_POLL_INTERVAL: u64 = 100;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref POSTGRES_ADDR: String = env::var("POSTGRESS_ADDR").unwrap_or_else(|_| {
|
static ref POSTGRES_ADDR: String = env::var("POSTGRES_ADDR").unwrap_or_else(|_| {
|
||||||
let mut postgres_addr = DEFAULT_POSTGRES_ADDR.to_string();
|
let mut postgres_addr = DEFAULT_POSTGRES_ADDR.to_string();
|
||||||
postgres_addr.insert_str(11,
|
postgres_addr.insert_str(11,
|
||||||
&env::var("USER").unwrap_or_else(|_| {
|
match &env::var("USER") {
|
||||||
|
Err(_) => {
|
||||||
warn!("No USER env variable set. Connecting to Postgress with default `postgres` user");
|
warn!("No USER env variable set. Connecting to Postgress with default `postgres` user");
|
||||||
"postgres".to_string()
|
"postgres"
|
||||||
}).as_str()
|
},
|
||||||
);
|
Ok(user) => {
|
||||||
|
warn!("No POSTGRES_ADDR env variable set. Connecting to Postgress with the current user: {}", &user);
|
||||||
|
user
|
||||||
|
}
|
||||||
|
});
|
||||||
postgres_addr
|
postgres_addr
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,8 +69,8 @@ pub fn cross_origin_resource_sharing() -> warp::filters::cors::Cors {
|
|||||||
|
|
||||||
/// Initialize logging and read values from `src/.env`
|
/// Initialize logging and read values from `src/.env`
|
||||||
pub fn logging_and_env() {
|
pub fn logging_and_env() {
|
||||||
pretty_env_logger::init();
|
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
|
pretty_env_logger::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configure Postgres and return a connection
|
/// Configure Postgres and return a connection
|
||||||
|
@ -3,6 +3,7 @@ use crate::config;
|
|||||||
|
|
||||||
pub fn query_for_user_data(access_token: &str) -> (i64, Option<Vec<String>>, Vec<String>) {
|
pub fn query_for_user_data(access_token: &str) -> (i64, Option<Vec<String>>, Vec<String>) {
|
||||||
let conn = config::postgres();
|
let conn = config::postgres();
|
||||||
|
|
||||||
let query_result = conn
|
let query_result = conn
|
||||||
.query(
|
.query(
|
||||||
"
|
"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user