parent
a0a84d91ce
commit
ceae0f5993
4 changed files with 12 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2225,6 +2225,7 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"openssl",
|
"openssl",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
"percent-encoding",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest-middleware",
|
"reqwest-middleware",
|
||||||
|
|
|
@ -2,4 +2,8 @@
|
||||||
# https://join-lemmy.org/docs/en/administration/configuration.html
|
# https://join-lemmy.org/docs/en/administration/configuration.html
|
||||||
{
|
{
|
||||||
hostname: lemmy-alpha
|
hostname: lemmy-alpha
|
||||||
|
database: {
|
||||||
|
# Username to connect to postgres
|
||||||
|
user: "&££%^!£*!:::!"£:!:"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ html2text = "0.4.2"
|
||||||
rosetta-i18n = "0.1.2"
|
rosetta-i18n = "0.1.2"
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
typed-builder = "0.10.0"
|
typed-builder = "0.10.0"
|
||||||
|
percent-encoding = "2.2.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
rosetta-build = "0.1.2"
|
rosetta-build = "0.1.2"
|
||||||
|
|
|
@ -6,6 +6,7 @@ use crate::{
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use deser_hjson::from_str;
|
use deser_hjson::from_str;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::{env, fs, io::Error};
|
use std::{env, fs, io::Error};
|
||||||
|
|
||||||
|
@ -44,7 +45,11 @@ impl Settings {
|
||||||
let conf = &self.database;
|
let conf = &self.database;
|
||||||
format!(
|
format!(
|
||||||
"postgres://{}:{}@{}:{}/{}",
|
"postgres://{}:{}@{}:{}/{}",
|
||||||
conf.user, conf.password, conf.host, conf.port, conf.database,
|
utf8_percent_encode(&conf.user, NON_ALPHANUMERIC),
|
||||||
|
utf8_percent_encode(&conf.password, NON_ALPHANUMERIC),
|
||||||
|
conf.host,
|
||||||
|
conf.port,
|
||||||
|
utf8_percent_encode(&conf.database, NON_ALPHANUMERIC),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue