3 Commits
0.1 ... 0.1.3

7 changed files with 24 additions and 14 deletions

8
Cargo.lock generated
View File

@@ -588,7 +588,7 @@ dependencies = [
[[package]] [[package]]
name = "dns-comunications" name = "dns-comunications"
version = "0.1.1" version = "0.1.1"
source = "git+ssh://git@rochegmr.com/groche97/dns_manager.git#f2e6d7102d4804568bfa1882bf8eabe9ac0105a9" source = "git+https://rochegmr.com/git/groche97/dns_manager.git?rev=ddcd867dced9546687e1d82a3fbc81db5edc04d8#ddcd867dced9546687e1d82a3fbc81db5edc04d8"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"dns-config", "dns-config",
@@ -598,7 +598,7 @@ dependencies = [
[[package]] [[package]]
name = "dns-config" name = "dns-config"
version = "0.1.1" version = "0.1.1"
source = "git+ssh://git@rochegmr.com/groche97/dns_manager.git#f2e6d7102d4804568bfa1882bf8eabe9ac0105a9" source = "git+https://rochegmr.com/git/groche97/dns_manager.git?rev=ddcd867dced9546687e1d82a3fbc81db5edc04d8#ddcd867dced9546687e1d82a3fbc81db5edc04d8"
dependencies = [ dependencies = [
"toml", "toml",
] ]
@@ -606,7 +606,7 @@ dependencies = [
[[package]] [[package]]
name = "dns-update" name = "dns-update"
version = "0.1.6" version = "0.1.6"
source = "git+ssh://git@github.com/stalwartlabs/dns-update.git#3a0985996dc8119c4adf1d25c6924ea6b981438e" source = "git+https://github.com/stalwartlabs/dns-update.git#3a0985996dc8119c4adf1d25c6924ea6b981438e"
dependencies = [ dependencies = [
"hickory-client", "hickory-client",
"reqwest", "reqwest",
@@ -620,7 +620,7 @@ dependencies = [
[[package]] [[package]]
name = "dns_manager" name = "dns_manager"
version = "0.1.1" version = "0.1.1"
source = "git+ssh://git@rochegmr.com/groche97/dns_manager.git#f2e6d7102d4804568bfa1882bf8eabe9ac0105a9" source = "git+https://rochegmr.com/git/groche97/dns_manager.git?rev=ddcd867dced9546687e1d82a3fbc81db5edc04d8#ddcd867dced9546687e1d82a3fbc81db5edc04d8"
dependencies = [ dependencies = [
"dns-comunications", "dns-comunications",
"dns-config", "dns-config",

View File

@@ -16,7 +16,7 @@ serde = "*"
serde_json = "*" serde_json = "*"
fallible-iterator = "*" fallible-iterator = "*"
toml = "0.9" toml = "0.9"
dns_manager = { git = "ssh://git@rochegmr.com/groche97/dns_manager.git"} dns_manager = { git = "https://rochegmr.com/git/groche97/dns_manager.git", rev = "ddcd867dced9546687e1d82a3fbc81db5edc04d8"}
[target.x86_64-unknown-linux-gnu] [target.x86_64-unknown-linux-gnu]
rustflags = [ rustflags = [

View File

@@ -3,4 +3,8 @@ pub mod mrproxy;
pub mod server; pub mod server;
pub(in crate::config) mod utils; pub(in crate::config) mod utils;
#[cfg(not(debug_assertions))]
pub const CONFIG_PATH: &str = "/etc/mrdeploy/config.toml";
#[cfg(debug_assertions)]
pub const CONFIG_PATH: &str = "config/config.toml"; pub const CONFIG_PATH: &str = "config/config.toml";

View File

@@ -1,12 +1,18 @@
use crate::controller::Controller; use crate::controller::Controller;
impl Controller { impl Controller {
pub async fn add_domain_to_dns(&self, domain: &str) -> Result<(), Box<dyn std::error::Error>> { pub(in crate::controller) async fn add_domain_to_dns(
&self,
domain: &str,
) -> Result<(), Box<dyn std::error::Error>> {
self.dns_manager.add_domain(domain, self.pub_addr).await?; self.dns_manager.add_domain(domain, self.pub_addr).await?;
Ok(()) Ok(())
} }
pub async fn del_domain_to_dns(&self, domain: &str) -> Result<(), Box<dyn std::error::Error>> { pub(in crate::controller) async fn del_domain_to_dns(
&self,
domain: &str,
) -> Result<(), Box<dyn std::error::Error>> {
self.dns_manager.del_domain(domain).await?; self.dns_manager.del_domain(domain).await?;
Ok(()) Ok(())
} }

View File

@@ -6,7 +6,7 @@ use crate::{
}; };
impl Controller { impl Controller {
pub async fn load_container( pub(in crate::controller) async fn load_container(
&self, &self,
docker_id: Option<String>, docker_id: Option<String>,
domain: String, domain: String,
@@ -31,7 +31,7 @@ impl Controller {
self.started self.started
} }
pub async fn prune_given_container( pub(in crate::controller) async fn prune_given_container(
&self, &self,
container: Container, container: Container,
) -> Result<String, Box<dyn Error>> { ) -> Result<String, Box<dyn Error>> {
@@ -41,7 +41,7 @@ impl Controller {
} }
} }
pub async fn stop_given_container( pub(in crate::controller) async fn stop_given_container(
&self, &self,
container: Container, container: Container,
) -> Result<String, bollard::errors::Error> { ) -> Result<String, bollard::errors::Error> {

View File

@@ -6,7 +6,7 @@ use crate::{
use log::error; use log::error;
impl Controller { impl Controller {
pub async fn load_container_and_bind( pub(in crate::controller) async fn load_container_and_bind(
&self, &self,
docker_id: Option<String>, docker_id: Option<String>,
domain: String, domain: String,
@@ -39,7 +39,7 @@ impl Controller {
} }
} }
pub async fn start_container_from_instance(&self, instance: Instance) { pub(in crate::controller) async fn start_container_from_instance(&self, instance: Instance) {
let image = match self let image = match self
.storage .storage
.lock() .lock()

View File

@@ -1,7 +1,7 @@
use crate::{controller::Controller, mcproxy_client}; use crate::{controller::Controller, mcproxy_client};
impl Controller { impl Controller {
pub async fn bind_container_in_proxy( pub(in crate::controller) async fn bind_container_in_proxy(
&self, &self,
domain: &str, domain: &str,
ip: &str, ip: &str,
@@ -12,7 +12,7 @@ impl Controller {
Ok(()) Ok(())
} }
pub async fn unbind_container_in_proxy( pub(in crate::controller) async fn unbind_container_in_proxy(
&self, &self,
domain: &str, domain: &str,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {