pub struct Compose {
pub services: HashMap<String, Service>,
pub networks: HashMap<String, Network>,
pub volumes: HashMap<String, Volume>,
pub executable: String,
pub file: String,
pub detached: bool,
}
Expand description
The root struct of the compose file.
Fields§
§services: HashMap<String, Service>
§networks: HashMap<String, Network>
§volumes: HashMap<String, Volume>
§executable: String
§file: String
§detached: bool
Implementations§
Source§impl Compose
impl Compose
Sourcepub fn new(config: Config) -> Self
pub fn new(config: Config) -> Self
Generate a compose file
ⓘ
use crate::generators::env::{ EnvironmentFile };
use crate::generators::compose::{ Compose};
use crate::generators::config::{ Config };
let mut config = Config::load("config-test.toml".to_string());
let deploy_dir: String = format!("{}/{}",config.settings.base_dir,&config.settings.deploy_dir);
let services_dir: String = format!("{}/{}",config.settings.base_dir,&config.settings.services_dir);
let compose_file: String = String::from("docker-compose-test.yaml");
config.validate();
let env_file_paths: Vec<String> = EnvironmentFile::generate(&config.env_files,&deploy_dir);
assert_eq!(env_file_paths.len()>0,true);
let compose_file_path : String = Compose::generate(&mut config.services,&config.networks,&config.volumes,&config.repositories, compose_file,&deploy_dir,&services_dir);
assert_eq!(!compose_file_path.is_empty(),true);
pub fn generate( services: &mut Vec<Service>, networks: &Vec<Network>, volumes: &Vec<Volume>, repositories: &Vec<Repository>, file_name: String, deploy_dir: &String, services_dir: &String, ) -> Self
pub fn insert_service(&mut self, name: String, data: Service)
pub fn insert_network(&mut self, name: String, data: Network)
pub fn insert_volume(&mut self, name: String, data: Volume)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Compose
impl<'de> Deserialize<'de> for Compose
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Compose
impl RefUnwindSafe for Compose
impl Send for Compose
impl Sync for Compose
impl Unpin for Compose
impl UnwindSafe for Compose
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more