refactor(controller): simplify PostgreSQL DSN connection string output
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -409,15 +409,6 @@ dependencies = [
|
|||||||
"litrs",
|
"litrs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dsn"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a68ec86c8ab056c40c4d3f6a543ad0ad6a251d7d01dac251feed242aa44e754a"
|
|
||||||
dependencies = [
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dyn-clone"
|
name = "dyn-clone"
|
||||||
version = "1.0.20"
|
version = "1.0.20"
|
||||||
@@ -1103,7 +1094,6 @@ dependencies = [
|
|||||||
"cliclack",
|
"cliclack",
|
||||||
"colored",
|
"colored",
|
||||||
"comfy-table",
|
"comfy-table",
|
||||||
"dsn",
|
|
||||||
"futures",
|
"futures",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
"miette",
|
"miette",
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ clap = { version = "4.5.53", features = ["derive"] }
|
|||||||
cliclack = "0.3.7"
|
cliclack = "0.3.7"
|
||||||
colored = "3.0.0"
|
colored = "3.0.0"
|
||||||
comfy-table = "7.2.1"
|
comfy-table = "7.2.1"
|
||||||
dsn = "1.2.1"
|
|
||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
indicatif = { version = "0.18.3", features = ["improved_unicode"] }
|
indicatif = { version = "0.18.3", features = ["improved_unicode"] }
|
||||||
miette = { version = "7.6.0", features = ["fancy"] }
|
miette = { version = "7.6.0", features = ["fancy"] }
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use dsn::DSN;
|
|
||||||
use miette::miette;
|
use miette::miette;
|
||||||
|
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
@@ -92,15 +91,10 @@ impl Controller {
|
|||||||
|
|
||||||
match format {
|
match format {
|
||||||
ConnectionFormat::DSN => {
|
ConnectionFormat::DSN => {
|
||||||
let dsn = DSN::builder()
|
println!(
|
||||||
.driver("postgres")
|
"postgres://{}:{}@127.0.0.1:{}/{}",
|
||||||
.username(USERNAME)
|
USERNAME, project.config.password, project.config.port, DATABASE
|
||||||
.password(project.config.password.clone())
|
);
|
||||||
.host("127.0.0.1")
|
|
||||||
.port(project.config.port)
|
|
||||||
.database(DATABASE)
|
|
||||||
.build();
|
|
||||||
println!("{}", dsn.to_string());
|
|
||||||
}
|
}
|
||||||
ConnectionFormat::Human => {
|
ConnectionFormat::Human => {
|
||||||
format_conn_human(project);
|
format_conn_human(project);
|
||||||
|
|||||||
Reference in New Issue
Block a user