fix: call default user if empty. resolves #10604
This commit is contained in:
parent
0a3e3643ab
commit
5847e986fb
2 changed files with 8 additions and 6 deletions
|
@ -42,13 +42,15 @@ async fn main() {
|
||||||
None => "redis",
|
None => "redis",
|
||||||
Some(_) => "rediss",
|
Some(_) => "rediss",
|
||||||
};
|
};
|
||||||
let redis_uri_userpass = match redis_conf.user {
|
let redis_user = redis_conf.user.unwrap_or("default".to_string());
|
||||||
None => "".to_string(),
|
let redis_uri_userpass = format!(
|
||||||
Some(user) => format!("{}:{}@", user, encode(&redis_conf.pass.unwrap_or_default())),
|
"{}:{}",
|
||||||
};
|
redis_user,
|
||||||
|
encode(&redis_conf.pass.unwrap_or_default())
|
||||||
|
);
|
||||||
let redis_uri_hostport = format!("{}:{}", redis_conf.host, redis_conf.port);
|
let redis_uri_hostport = format!("{}:{}", redis_conf.host, redis_conf.port);
|
||||||
let redis_uri = format!(
|
let redis_uri = format!(
|
||||||
"{}://{}{}/{}",
|
"{}://{}@{}/{}",
|
||||||
redis_proto, redis_uri_userpass, redis_uri_hostport, redis_conf.db
|
redis_proto, redis_uri_userpass, redis_uri_hostport, redis_conf.db
|
||||||
);
|
);
|
||||||
env::set_var(CACHE_URL_ENV, redis_uri);
|
env::set_var(CACHE_URL_ENV, redis_uri);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"artifacts": "napi artifacts",
|
"artifacts": "napi artifacts",
|
||||||
"build": "pnpm run build:napi && pnpm run build:migration",
|
"build": "pnpm run build:napi && pnpm run build:migration",
|
||||||
"build:napi": "napi build --features napi --platform --release ./built/",
|
"build:napi": "napi build --features napi --platform --release ./built/",
|
||||||
"build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp ./target/release/migration ./built/migration",
|
"build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp -v ./target/release/migration ./built/migration",
|
||||||
"build:debug": "napi build --features napi --platform ./built/ && cargo build --locked --manifest-path ./migration/Cargo.toml && cp -v ./target/debug/migration ./built/migration",
|
"build:debug": "napi build --features napi --platform ./built/ && cargo build --locked --manifest-path ./migration/Cargo.toml && cp -v ./target/debug/migration ./built/migration",
|
||||||
"prepublishOnly": "napi prepublish -t npm",
|
"prepublishOnly": "napi prepublish -t npm",
|
||||||
"test": "pnpm run cargo:test && pnpm run build:napi && ava",
|
"test": "pnpm run cargo:test && pnpm run build:napi && ava",
|
||||||
|
|
Loading…
Reference in a new issue