diff --git a/src/constants.rs b/src/constants.rs
index d04c1e3d..ecc07488 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -34,3 +34,27 @@ StandardError=file:/var/log/rrdb.stderr.log
[Install]
WantedBy=multi-user.target"#;
+
+#[cfg(target_os = "macos")]
+pub const LAUNCHD_DAEMON_SCRIPT: &str = r#"
+
+
+
+ Label
+ myyrakle.github.io.rrdb
+ UserName
+ root
+ Program
+ /usr/local/bin/rrdb
+ ProgramArguments
+
+ run
+
+ RunAtLoad
+
+ StandardOutPath
+ /var/log/rrdb.stdout.log
+ StandardErrorPath
+ /var/log/rrdb.stderr.log
+
+"#;
diff --git a/src/executor/initializer.rs b/src/executor/initializer.rs
index 869b7f57..c7b336bf 100644
--- a/src/executor/initializer.rs
+++ b/src/executor/initializer.rs
@@ -108,31 +108,12 @@ impl Executor {
#[cfg(target_os = "macos")]
async fn create_daemon_config_if_not_exists(&self) -> Result<(), RRDBError> {
+ use crate::constants::LAUNCHD_DAEMON_SCRIPT;
+
let base_path = PathBuf::from(LAUNCHD_PLIST_PATH);
- let script = r#"
-
-
-
- Label
- myyrakle.github.io.rrdb
- UserName
- root
- Program
- /usr/local/bin/rrdb
- ProgramArguments
-
- run
-
- RunAtLoad
-
- StandardOutPath
- /var/log/rrdb.stdout.log
- StandardErrorPath
- /var/log/rrdb.stderr.log
-
-"#;
-
- self.write_and_check_err(base_path, script).await
+
+ self.write_and_check_err(base_path, LAUNCHD_DAEMON_SCRIPT)
+ .await
}
#[cfg(target_os = "windows")]