test: config search path (using docker)

This commit is contained in:
Suyono 2023-11-23 09:42:17 +11:00
parent 1b5c48071c
commit 6e85e12993
8 changed files with 23 additions and 1 deletions

View File

@ -10,7 +10,8 @@
"dustypomerleau.rust-syntax", "dustypomerleau.rust-syntax",
"1YiB.rust-bundle", "1YiB.rust-bundle",
"serayuzgur.crates", "serayuzgur.crates",
"tamasfe.even-better-toml" "tamasfe.even-better-toml",
"ms-azuretools.vscode-docker"
] ]
} }
} }

9
docker/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM ubuntu:22.04
ADD target/debug/init /usr/local/bin/init
ADD docker/ /
RUN chmod ugo+x /etc/wingmate/services/one && chmod ugo+x /etc/wingmate/services/two.sh && \
chmod ugo-x /etc/wingmate/services/three.sh
CMD [ "/usr/local/bin/init" ]

0
docker/entry.sh Normal file
View File

View File

@ -0,0 +1,3 @@
#!/bin/bash
exec sleep 1

View File

@ -0,0 +1,3 @@
#!/bin/bash
exec sleep 1

View File

@ -0,0 +1,3 @@
#!/bin/bash
exec sleep 1

View File

@ -6,5 +6,6 @@ use std::error as std_err;
pub async fn start() -> Result<(), Box<dyn std_err::Error>> { pub async fn start() -> Result<(), Box<dyn std_err::Error>> {
let _config = config::Config::find(vec![String::from("/etc/wingmate")])?; let _config = config::Config::find(vec![String::from("/etc/wingmate")])?;
dbg!(_config);
daemon::start().await daemon::start().await
} }

View File

@ -4,11 +4,13 @@ use std::error as std_error;
use crate::init::error as wingmate_error; use crate::init::error as wingmate_error;
use nix::unistd::{access, AccessFlags}; use nix::unistd::{access, AccessFlags};
#[derive(Debug)]
pub enum Command { pub enum Command {
ShellPrefixed(String), ShellPrefixed(String),
Direct(String) Direct(String)
} }
#[derive(Debug)]
pub struct Config { pub struct Config {
pub services: Vec<Command>, pub services: Vec<Command>,
} }