Compare commits
No commits in common. "a58024c19212f724053e8417114fd225b157d09e" and "39b1a84c55e3135ae60d4ba815c06aa868e08d9e" have entirely different histories.
a58024c192
...
39b1a84c55
3 changed files with 9 additions and 24 deletions
12
flake.nix
12
flake.nix
|
|
@ -41,6 +41,12 @@
|
||||||
# Additional darwin specific inputs can be set here
|
# Additional darwin specific inputs can be set here
|
||||||
pkgs.libiconv
|
pkgs.libiconv
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Additional environment variables can be set directly
|
||||||
|
# MY_CUSTOM_VAR = "some value";
|
||||||
|
COMMIT_HASH = builtins.substring 0 7 (
|
||||||
|
if self ? rev then self.rev else "NoDHash"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
craneLibLLvmTools = craneLib.overrideToolchain
|
craneLibLLvmTools = craneLib.overrideToolchain
|
||||||
|
|
@ -58,12 +64,6 @@
|
||||||
# artifacts from above.
|
# artifacts from above.
|
||||||
my-crate = craneLib.buildPackage (commonArgs // {
|
my-crate = craneLib.buildPackage (commonArgs // {
|
||||||
inherit cargoArtifacts;
|
inherit cargoArtifacts;
|
||||||
|
|
||||||
# Additional environment variables can be set directly
|
|
||||||
# MY_CUSTOM_VAR = "some value";
|
|
||||||
COMMIT_HASH = builtins.substring 0 7 (
|
|
||||||
if self ? rev then self.rev else "NoDHash"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,6 @@ impl MinecraftAPI<Server> for McApi {
|
||||||
dep: deployment,
|
dep: deployment,
|
||||||
srv: service,
|
srv: service,
|
||||||
server_addr: addr.to_string(),
|
server_addr: addr.to_string(),
|
||||||
server_port: port.to_string(),
|
|
||||||
cache: self.cache.clone(),
|
cache: self.cache.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -159,16 +158,7 @@ impl MinecraftAPI<Server> for McApi {
|
||||||
tracing::info!("starting watcher");
|
tracing::info!("starting watcher");
|
||||||
loop {
|
loop {
|
||||||
tokio::time::sleep(frequency).await;
|
tokio::time::sleep(frequency).await;
|
||||||
let server = match api.query_server(&addr, &port).await {
|
let server = api.query_server(&addr, &port).await.unwrap();
|
||||||
Ok(x) => x,
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!(
|
|
||||||
err = format!("{}", e.context),
|
|
||||||
"could not query server"
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let status_json = match server.query_description().await {
|
let status_json = match server.query_description().await {
|
||||||
Ok(x) => x,
|
Ok(x) => x,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -224,7 +214,6 @@ pub struct Server {
|
||||||
dep: Deployment,
|
dep: Deployment,
|
||||||
srv: Service,
|
srv: Service,
|
||||||
server_addr: String,
|
server_addr: String,
|
||||||
server_port: String,
|
|
||||||
cache: KubeCache,
|
cache: KubeCache,
|
||||||
}
|
}
|
||||||
impl fmt::Debug for Server {
|
impl fmt::Debug for Server {
|
||||||
|
|
@ -312,7 +301,7 @@ impl MinecraftServerHandle for Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_internal_address(&self) -> Option<String> {
|
fn get_internal_address(&self) -> Option<String> {
|
||||||
Some(format!("localhost:{}", self.get_internal_port()?))
|
Some(format!("localhost:{}", self.get_port()?))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_addr(&self) -> Option<String> {
|
fn get_addr(&self) -> Option<String> {
|
||||||
|
|
@ -361,14 +350,11 @@ impl MinecraftServerHandle for Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_internal_port(&self) -> Option<String> {
|
fn get_port(&self) -> Option<String> {
|
||||||
let a = self.srv.clone().spec.unwrap().ports.unwrap();
|
let a = self.srv.clone().spec.unwrap().ports.unwrap();
|
||||||
let port = a.iter().find(|x| x.name.clone().unwrap() == "mc-router")?;
|
let port = a.iter().find(|x| x.name.clone().unwrap() == "mc-router")?;
|
||||||
port.node_port.map(|x| x.to_string())
|
port.node_port.map(|x| x.to_string())
|
||||||
}
|
}
|
||||||
fn get_port(&self) -> Option<String> {
|
|
||||||
Some(self.server_port.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_motd(&self) -> Option<String> {
|
fn get_motd(&self) -> Option<String> {
|
||||||
let all_container_motds = self
|
let all_container_motds = self
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ pub trait MinecraftServerHandle: Clone {
|
||||||
async fn stop(&self) -> Result<(), OpaqueError>;
|
async fn stop(&self) -> Result<(), OpaqueError>;
|
||||||
async fn query_status(&self) -> Result<ServerDeploymentStatus, OpaqueError>;
|
async fn query_status(&self) -> Result<ServerDeploymentStatus, OpaqueError>;
|
||||||
fn get_internal_address(&self) -> Option<String>;
|
fn get_internal_address(&self) -> Option<String>;
|
||||||
fn get_internal_port(&self) -> Option<String>;
|
|
||||||
fn get_addr(&self) -> Option<String>;
|
fn get_addr(&self) -> Option<String>;
|
||||||
fn get_port(&self) -> Option<String>;
|
fn get_port(&self) -> Option<String>;
|
||||||
fn get_motd(&self) -> Option<String>;
|
fn get_motd(&self) -> Option<String>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue