mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
push: go trough proxy
This commit is contained in:
parent
d943766267
commit
48843efe1a
2 changed files with 6 additions and 5 deletions
|
|
@ -2,7 +2,6 @@ use crate::service::ServiceTrait;
|
||||||
use crate::{Cloud, HazeConfig};
|
use crate::{Cloud, HazeConfig};
|
||||||
use crate::{Result, Service};
|
use crate::{Result, Service};
|
||||||
use bollard::Docker;
|
use bollard::Docker;
|
||||||
use hyper::http::uri::Builder;
|
|
||||||
use miette::{miette, IntoDiagnostic};
|
use miette::{miette, IntoDiagnostic};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
|
|
@ -18,9 +17,8 @@ use tokio::spawn;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
use tokio_stream::wrappers::UnixListenerStream;
|
use tokio_stream::wrappers::UnixListenerStream;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
use warp::host::Authority;
|
|
||||||
use warp::http::header::HOST;
|
use warp::http::header::HOST;
|
||||||
use warp::http::{HeaderValue, Uri};
|
use warp::http::HeaderValue;
|
||||||
use warp::hyper::server::accept::from_stream;
|
use warp::hyper::server::accept::from_stream;
|
||||||
use warp::hyper::server::conn::AddrStream;
|
use warp::hyper::server::conn::AddrStream;
|
||||||
use warp::hyper::service::{make_service_fn, service_fn};
|
use warp::hyper::service::{make_service_fn, service_fn};
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,15 @@ impl ServiceTrait for NotifyPush {
|
||||||
&self,
|
&self,
|
||||||
docker: &Docker,
|
docker: &Docker,
|
||||||
cloud_id: &str,
|
cloud_id: &str,
|
||||||
_config: &HazeConfig,
|
config: &HazeConfig,
|
||||||
) -> Result<Vec<String>> {
|
) -> Result<Vec<String>> {
|
||||||
let ip = self.get_ip(docker, cloud_id).await?;
|
let ip = self.get_ip(docker, cloud_id).await?;
|
||||||
|
let addr = config
|
||||||
|
.proxy
|
||||||
|
.addr_with_port(&self.container_name(cloud_id), ip, 7867);
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
format!("occ config:system:set trusted_proxies 1 --value {}", ip),
|
format!("occ config:system:set trusted_proxies 1 --value {}", ip),
|
||||||
format!("occ notify_push:setup http://{}:7867", ip),
|
format!("occ notify_push:setup {}", addr),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue