mirror of
https://codeberg.org/icewind/haze.git
synced 2026-08-02 12:14:46 +02:00
parent
a38de3fdee
commit
33b1fdcd6e
1 changed files with 21 additions and 2 deletions
23
src/php.rs
23
src/php.rs
|
|
@ -1,4 +1,3 @@
|
||||||
use owo_colors::OwoColorize;
|
|
||||||
use crate::config::ProxyConfig;
|
use crate::config::ProxyConfig;
|
||||||
use crate::database::Database;
|
use crate::database::Database;
|
||||||
use crate::image::{image_version, pull_image, ImageVersion};
|
use crate::image::{image_version, pull_image, ImageVersion};
|
||||||
|
|
@ -12,7 +11,9 @@ use bollard::Docker;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use maplit::hashmap;
|
use maplit::hashmap;
|
||||||
use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
||||||
|
use owo_colors::OwoColorize;
|
||||||
use reqwest::{Client, Url};
|
use reqwest::{Client, Url};
|
||||||
|
use std::iter::once;
|
||||||
use std::net::{IpAddr, Ipv4Addr};
|
use std::net::{IpAddr, Ipv4Addr};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
@ -129,7 +130,11 @@ impl PhpVersion {
|
||||||
let haze_version = ImageVersion::from_str(env!("CARGO_PKG_VERSION"));
|
let haze_version = ImageVersion::from_str(env!("CARGO_PKG_VERSION"));
|
||||||
if let (Some(image_version), Ok(haze_version)) = (image_version, haze_version) {
|
if let (Some(image_version), Ok(haze_version)) = (image_version, haze_version) {
|
||||||
if image_version < haze_version {
|
if image_version < haze_version {
|
||||||
eprintln!("{}: image version is out of date, run {} to update.", "Warning".red(), "haze update".blue());
|
eprintln!(
|
||||||
|
"{}: image version is out of date, run {} to update.",
|
||||||
|
"Warning".red(),
|
||||||
|
"haze update".blue()
|
||||||
|
);
|
||||||
eprintln!(" Haze version: {}", haze_version.bright_yellow());
|
eprintln!(" Haze version: {}", haze_version.bright_yellow());
|
||||||
eprintln!(" Image version: {}", image_version.bright_yellow());
|
eprintln!(" Image version: {}", image_version.bright_yellow());
|
||||||
}
|
}
|
||||||
|
|
@ -160,6 +165,20 @@ impl PhpVersion {
|
||||||
proxy_config.addr(id, IpAddr::V4(Ipv4Addr::LOCALHOST))
|
proxy_config.addr(id, IpAddr::V4(Ipv4Addr::LOCALHOST))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
env.push(format!("INSTANCE_ID={}", id.trim_start_matches("haze-")));
|
||||||
|
env.push(format!("INSTANCE_PHP={}", self.name()));
|
||||||
|
env.push(format!("INSTANCE_DB={}", db.family()));
|
||||||
|
env.push(format!(
|
||||||
|
"INSTANCE_SERVICES={}",
|
||||||
|
once("")
|
||||||
|
.chain(services.iter().map(ServiceTrait::name))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(" ")
|
||||||
|
));
|
||||||
|
env.push(
|
||||||
|
"PS1=${INSTANCE_ID} [${INSTANCE_PHP} ${INSTANCE_DB}${INSTANCE_SERVICES}]> ".into(),
|
||||||
|
);
|
||||||
|
|
||||||
env.push(format!("HOST_IP={host}"));
|
env.push(format!("HOST_IP={host}"));
|
||||||
if !proxy_config.address.is_empty() {
|
if !proxy_config.address.is_empty() {
|
||||||
env.push(format!("PROXY_BASE={}", proxy_config.address));
|
env.push(format!("PROXY_BASE={}", proxy_config.address));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue