Started work on Dockerfile

main
David 2022-12-29 19:29:28 +01:00
parent 12f10233f1
commit fe50f74723
3 changed files with 19 additions and 1 deletions

13
Dockerfile 100644
View File

@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1
FROM rust:latest as builder
COPY . .
RUN cargo build --release
RUN cargo run
FROM rust:latest
COPY --from=builder /target /target
COPY --from=builder config.ini
WORKDIR /target
RUN ./matrix-modbot
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl --fail http://localhost:5000/health || exit 1

View File

@ -1,3 +1,7 @@
# Matrix Modbot
Matrix Modbot is a bot for Matrix used to automatically moderate Matrix rooms.
## Who is this bot for?
The bot is orientated towards admins of large Matrix rooms that are public and require moderation. With this bot, simple jobs such as swear filtering and spam prevention could be accomplished without intervention of human moderators.

View File

@ -14,7 +14,8 @@ pub mod config_reader {
}
impl BotUserInfo {
pub fn get_info(config_file_path: &str) -> Result<Self, Box<dyn Error>> {
pub fn get_info(config_file_path: Option<&str>) -> Result<Self, Box<dyn Error>> {
let config_file_path = config_file_path.unwrap_or("config.ini");
let mut config = Ini::new();
let _map = config.load(config_file_path)?;
let user_id = config.get("credentials", "user_id").unwrap();