mirror of
https://codeberg.org/icewind/haze.git
synced 2026-10-01 16:54:08 +02:00
feat(start): Print the database location on start
Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
parent
7121474198
commit
52cc29060b
2 changed files with 47 additions and 11 deletions
24
src/main.rs
24
src/main.rs
|
|
@ -422,21 +422,15 @@ async fn main() -> Result<ExitCode> {
|
|||
let ip = cloud
|
||||
.ip
|
||||
.ok_or_else(|| Report::msg(format!("{} is not running", cloud.id)))?;
|
||||
let db_type = match cloud.db().family() {
|
||||
match cloud.db().family() {
|
||||
DatabaseFamily::Sqlite => {
|
||||
return Err(Report::msg("sqlite is not supported with `haze env`"));
|
||||
}
|
||||
DatabaseFamily::Oracle => {
|
||||
return Err(Report::msg("oracle is not supported with `haze env`"));
|
||||
}
|
||||
DatabaseFamily::Mysql | DatabaseFamily::MariaDB => "mysql",
|
||||
DatabaseFamily::Postgres => "postgresql",
|
||||
};
|
||||
let db_ip = cloud
|
||||
.db()
|
||||
.ip(&docker, &cloud.id)
|
||||
.await
|
||||
.ok_or_else(|| Report::msg(format!("{}-db is not running", cloud.id)))?;
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let mut command = Command::new(command);
|
||||
command
|
||||
|
|
@ -445,7 +439,7 @@ async fn main() -> Result<ExitCode> {
|
|||
.env("NEXTCLOUD_URL", &cloud.address)
|
||||
.env(
|
||||
"DATABASE_URL",
|
||||
format!("{}://haze:haze@{}/haze", db_type, db_ip),
|
||||
cloud.db().location(&docker, &cloud.id, &config).await?,
|
||||
);
|
||||
|
||||
if cloud.services().contains(&Service::RedisTls(RedisTls)) {
|
||||
|
|
@ -552,6 +546,16 @@ async fn setup(
|
|||
let cloud = Cloud::create(docker, options, config).await?;
|
||||
println!("{}", cloud.address);
|
||||
let host = cloud.address.split_once("://").expect("no address?").1;
|
||||
|
||||
match cloud.db().location(docker, &cloud.id, config).await {
|
||||
Ok(value) => {
|
||||
println!("Database: {}", value);
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to print DB location: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
if always_setup || config.auto_setup.enabled {
|
||||
println!("Waiting for servers to start");
|
||||
cloud.wait_for_start(docker).await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue