refactor: extract server crate
This commit is contained in:
parent
834dff4370
commit
3a112ddd8b
39 changed files with 128 additions and 54 deletions
|
@ -1,6 +1,10 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = ["crates/cli"]
|
members = ["crates/cli", "crates/server"]
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
|
version = "0.3.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
nursery = { level = "warn", priority = -1 }
|
nursery = { level = "warn", priority = -1 }
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
[package]
|
[package]
|
||||||
name = "git-next"
|
name = "git-next"
|
||||||
version = "0.3.0"
|
version = { workspace = true }
|
||||||
edition = "2021"
|
edition = { workspace = true }
|
||||||
|
|
||||||
[features]
|
# [features]
|
||||||
default = ["forgejo"]
|
# default = ["forgejo"]
|
||||||
forgejo = []
|
# forgejo = []
|
||||||
github = []
|
# github = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
git-next-server = { path = "../server" }
|
||||||
|
|
||||||
# CLI parsing
|
# CLI parsing
|
||||||
clap = { workspace = true }
|
clap = { workspace = true }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
mod init;
|
mod init;
|
||||||
mod server;
|
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
@ -36,10 +35,10 @@ async fn main() {
|
||||||
}
|
}
|
||||||
Command::Server(server) => match server {
|
Command::Server(server) => match server {
|
||||||
Server::Init => {
|
Server::Init => {
|
||||||
server::init(fs);
|
git_next_server::init(fs);
|
||||||
}
|
}
|
||||||
Server::Start => {
|
Server::Start => {
|
||||||
server::start(fs, net).await;
|
git_next_server::start(fs, net).await;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
73
crates/server/Cargo.toml
Normal file
73
crates/server/Cargo.toml
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
[package]
|
||||||
|
name = "git-next-server"
|
||||||
|
version = { workspace = true }
|
||||||
|
edition = { workspace = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["forgejo"]
|
||||||
|
forgejo = []
|
||||||
|
github = []
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
# CLI parsing
|
||||||
|
clap = { workspace = true }
|
||||||
|
|
||||||
|
# logging
|
||||||
|
console-subscriber = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
|
tracing-subscriber = { workspace = true }
|
||||||
|
|
||||||
|
# base64 decoding
|
||||||
|
base64 = { workspace = true }
|
||||||
|
|
||||||
|
# git
|
||||||
|
# gix = { workspace = true }
|
||||||
|
gix = { workspace = true }
|
||||||
|
async-trait = { workspace = true }
|
||||||
|
|
||||||
|
# fs/network
|
||||||
|
kxio = { workspace = true }
|
||||||
|
|
||||||
|
# fs
|
||||||
|
tempfile = { workspace = true }
|
||||||
|
|
||||||
|
# TOML parsing
|
||||||
|
serde = { workspace = true }
|
||||||
|
serde_json = { workspace = true }
|
||||||
|
toml = { workspace = true }
|
||||||
|
|
||||||
|
# Secrets and Password
|
||||||
|
secrecy = { workspace = true }
|
||||||
|
|
||||||
|
# Conventional Commit check
|
||||||
|
git-conventional = { workspace = true }
|
||||||
|
|
||||||
|
# Webhooks
|
||||||
|
bytes = { workspace = true }
|
||||||
|
ulid = { workspace = true }
|
||||||
|
warp = { workspace = true }
|
||||||
|
|
||||||
|
# error handling
|
||||||
|
derive_more = { workspace = true }
|
||||||
|
terrors = { workspace = true }
|
||||||
|
|
||||||
|
# file watcher
|
||||||
|
inotify = { workspace = true }
|
||||||
|
|
||||||
|
# Actors
|
||||||
|
actix = { workspace = true }
|
||||||
|
actix-rt = { workspace = true }
|
||||||
|
tokio = { workspace = true }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
# Testing
|
||||||
|
assert2 = { workspace = true }
|
||||||
|
pretty_assertions = { workspace = true }
|
||||||
|
test-log = { workspace = true }
|
||||||
|
anyhow = { workspace = true }
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
nursery = { level = "warn", priority = -1 }
|
||||||
|
# pedantic = "warn"
|
||||||
|
unwrap_used = "warn"
|
||||||
|
expect_used = "warn"
|
|
@ -4,7 +4,7 @@ use actix::prelude::*;
|
||||||
|
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
actors::repo::{LoadConfigFromRepo, RepoActor, ValidateRepo},
|
actors::repo::{LoadConfigFromRepo, RepoActor, ValidateRepo},
|
||||||
config::{self, RepoConfigSource},
|
config::{self, RepoConfigSource},
|
||||||
gitforge,
|
gitforge,
|
|
@ -1,7 +1,7 @@
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
use crate::server::{config, gitforge};
|
use crate::{config, gitforge};
|
||||||
|
|
||||||
use super::{LoadedConfig, RepoActor};
|
use super::{LoadedConfig, RepoActor};
|
||||||
|
|
|
@ -7,7 +7,7 @@ use actix::prelude::*;
|
||||||
use kxio::network::Network;
|
use kxio::network::Network;
|
||||||
use tracing::{debug, info, warn, Instrument};
|
use tracing::{debug, info, warn, Instrument};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
actors::repo::webhook::WebhookAuth,
|
actors::repo::webhook::WebhookAuth,
|
||||||
config::{RepoConfig, RepoDetails, Webhook},
|
config::{RepoConfig, RepoDetails, Webhook},
|
||||||
gitforge::{self, Repository},
|
gitforge::{self, Repository},
|
||||||
|
@ -39,11 +39,11 @@ impl RepoActor {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let forge = match details.forge.forge_type {
|
let forge = match details.forge.forge_type {
|
||||||
#[cfg(feature = "forgejo")]
|
#[cfg(feature = "forgejo")]
|
||||||
crate::server::config::ForgeType::ForgeJo => {
|
crate::config::ForgeType::ForgeJo => {
|
||||||
gitforge::Forge::new_forgejo(details.clone(), net.clone())
|
gitforge::Forge::new_forgejo(details.clone(), net.clone())
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
crate::server::config::ForgeType::MockForge => gitforge::Forge::new_mock(),
|
crate::config::ForgeType::MockForge => gitforge::Forge::new_mock(),
|
||||||
};
|
};
|
||||||
debug!(?forge, "new");
|
debug!(?forge, "new");
|
||||||
Self {
|
Self {
|
|
@ -2,7 +2,7 @@ use actix::prelude::*;
|
||||||
use gix::trace::warn;
|
use gix::trace::warn;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
use crate::server::{actors::repo::ValidateRepo, gitforge, types::MessageToken};
|
use crate::{actors::repo::ValidateRepo, gitforge, types::MessageToken};
|
||||||
|
|
||||||
use super::AdvanceMainTo;
|
use super::AdvanceMainTo;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use ulid::DecodeError;
|
||||||
|
|
||||||
use std::{collections::HashMap, fmt::Display, ops::Deref, str::FromStr};
|
use std::{collections::HashMap, fmt::Display, ops::Deref, str::FromStr};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
actors::{
|
actors::{
|
||||||
repo::{RepoActor, ValidateRepo, WebhookRegistered},
|
repo::{RepoActor, ValidateRepo, WebhookRegistered},
|
||||||
webhook::WebhookMessage,
|
webhook::WebhookMessage,
|
||||||
|
@ -60,7 +60,7 @@ impl Deref for WebhookAuth {
|
||||||
#[tracing::instrument(skip_all, fields(%webhook_id))]
|
#[tracing::instrument(skip_all, fields(%webhook_id))]
|
||||||
pub async fn unregister(
|
pub async fn unregister(
|
||||||
webhook_id: WebhookId,
|
webhook_id: WebhookId,
|
||||||
repo_details: crate::server::config::RepoDetails,
|
repo_details: crate::config::RepoDetails,
|
||||||
net: network::Network,
|
net: network::Network,
|
||||||
) {
|
) {
|
||||||
let hostname = &repo_details.forge.hostname;
|
let hostname = &repo_details.forge.hostname;
|
||||||
|
@ -88,7 +88,7 @@ pub async fn unregister(
|
||||||
|
|
||||||
#[tracing::instrument(skip_all)]
|
#[tracing::instrument(skip_all)]
|
||||||
pub async fn register(
|
pub async fn register(
|
||||||
repo_details: crate::server::config::RepoDetails,
|
repo_details: crate::config::RepoDetails,
|
||||||
webhook: Webhook,
|
webhook: Webhook,
|
||||||
addr: actix::prelude::Addr<super::RepoActor>,
|
addr: actix::prelude::Addr<super::RepoActor>,
|
||||||
net: network::Network,
|
net: network::Network,
|
||||||
|
@ -147,7 +147,7 @@ pub async fn register(
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn find_existing_webhooks(
|
async fn find_existing_webhooks(
|
||||||
repo_details: &crate::server::config::RepoDetails,
|
repo_details: &crate::config::RepoDetails,
|
||||||
webhook_url: &WebhookUrl,
|
webhook_url: &WebhookUrl,
|
||||||
net: &network::Network,
|
net: &network::Network,
|
||||||
) -> Vec<WebhookId> {
|
) -> Vec<WebhookId> {
|
|
@ -5,7 +5,7 @@ use actix::prelude::*;
|
||||||
use kxio::{fs::FileSystem, network::Network};
|
use kxio::{fs::FileSystem, network::Network};
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
actors::{
|
actors::{
|
||||||
file_watcher::FileUpdated,
|
file_watcher::FileUpdated,
|
||||||
repo::{CloneRepo, RepoActor},
|
repo::{CloneRepo, RepoActor},
|
||||||
|
@ -28,7 +28,7 @@ pub enum Error {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
},
|
},
|
||||||
|
|
||||||
Config(crate::server::config::Error),
|
Config(crate::config::Error),
|
||||||
|
|
||||||
Io(std::io::Error),
|
Io(std::io::Error),
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use crate::server::actors::repo::webhook::WebhookAuth;
|
use crate::actors::repo::webhook::WebhookAuth;
|
||||||
|
|
||||||
#[derive(Message, Debug, Clone)]
|
#[derive(Message, Debug, Clone)]
|
||||||
#[rtype(result = "()")]
|
#[rtype(result = "()")]
|
|
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
|
|
||||||
use crate::server::{actors::webhook::message::WebhookMessage, config::RepoAlias};
|
use crate::{actors::webhook::message::WebhookMessage, config::RepoAlias};
|
||||||
|
|
||||||
pub struct WebhookRouter {
|
pub struct WebhookRouter {
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
|
@ -4,7 +4,7 @@ use actix::prelude::*;
|
||||||
|
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
|
|
||||||
use crate::server::actors::webhook::message::WebhookMessage;
|
use crate::actors::webhook::message::WebhookMessage;
|
||||||
|
|
||||||
pub async fn start(
|
pub async fn start(
|
||||||
socket_addr: SocketAddr,
|
socket_addr: SocketAddr,
|
|
@ -1,7 +1,7 @@
|
||||||
use terrors::OneOf;
|
use terrors::OneOf;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, RepoConfig, RepoDetails},
|
config::{BranchName, RepoConfig, RepoDetails},
|
||||||
gitforge::{self, ForgeFileError},
|
gitforge::{self, ForgeFileError},
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,7 @@ pub async fn load(
|
||||||
RepoConfig,
|
RepoConfig,
|
||||||
OneOf<(
|
OneOf<(
|
||||||
ForgeFileError,
|
ForgeFileError,
|
||||||
crate::server::config::Error,
|
crate::config::Error,
|
||||||
toml::de::Error,
|
toml::de::Error,
|
||||||
RepoConfigValidationErrors,
|
RepoConfigValidationErrors,
|
||||||
)>,
|
)>,
|
|
@ -16,7 +16,7 @@ use serde::Deserialize;
|
||||||
use kxio::fs::FileSystem;
|
use kxio::fs::FileSystem;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
use crate::server::{gitforge::Repository, types::ServerGeneration};
|
use crate::{gitforge::Repository, types::ServerGeneration};
|
||||||
|
|
||||||
#[derive(Debug, derive_more::From, derive_more::Display)]
|
#[derive(Debug, derive_more::From, derive_more::Display)]
|
||||||
pub enum Error {
|
pub enum Error {
|
|
@ -2,7 +2,7 @@ use assert2::let_assert;
|
||||||
use gix::remote::Direction;
|
use gix::remote::Direction;
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
use crate::{server::gitforge::tests::common /* server::gitforge::tests::common */};
|
use crate::{gitforge::tests::common /* server::gitforge::tests::common */};
|
||||||
|
|
||||||
use kxio::fs;
|
use kxio::fs;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::ops::Deref;
|
||||||
use secrecy::ExposeSecret;
|
use secrecy::ExposeSecret;
|
||||||
use tracing::{info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, RepoDetails},
|
config::{BranchName, RepoDetails},
|
||||||
gitforge::{BranchResetError, BranchResetResult, Force, Repository},
|
gitforge::{BranchResetError, BranchResetResult, Force, Repository},
|
||||||
types::GitRef,
|
types::GitRef,
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::server::config::{BranchName, GitDir};
|
use crate::config::{BranchName, GitDir};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ForgeFileError {
|
pub enum ForgeFileError {
|
|
@ -2,7 +2,7 @@ use std::ops::Deref;
|
||||||
|
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
|
|
||||||
use crate::server::{config::RepoDetails, gitforge::Repository};
|
use crate::{config::RepoDetails, gitforge::Repository};
|
||||||
|
|
||||||
#[derive(Debug, derive_more::From, derive_more::Display)]
|
#[derive(Debug, derive_more::From, derive_more::Display)]
|
||||||
pub enum Error {
|
pub enum Error {
|
|
@ -1,7 +1,7 @@
|
||||||
use kxio::network::{self, Network};
|
use kxio::network::{self, Network};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, RepoDetails},
|
config::{BranchName, RepoDetails},
|
||||||
gitforge::{self, ForgeBranchError},
|
gitforge::{self, ForgeBranchError},
|
||||||
};
|
};
|
|
@ -1,8 +1,7 @@
|
||||||
use kxio::network;
|
use kxio::network;
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
self,
|
|
||||||
config::{BranchName, RepoConfig, RepoDetails},
|
config::{BranchName, RepoConfig, RepoDetails},
|
||||||
gitforge::{self, ForgeLike},
|
gitforge::{self, ForgeLike},
|
||||||
};
|
};
|
||||||
|
@ -187,7 +186,7 @@ async fn get_commit_histories(
|
||||||
|
|
||||||
#[tracing::instrument(fields(%branch_name),skip_all)]
|
#[tracing::instrument(fields(%branch_name),skip_all)]
|
||||||
async fn get_commit_history(
|
async fn get_commit_history(
|
||||||
repo_details: &server::config::RepoDetails,
|
repo_details: &crate::config::RepoDetails,
|
||||||
branch_name: &BranchName,
|
branch_name: &BranchName,
|
||||||
find_commits: Vec<gitforge::Commit>,
|
find_commits: Vec<gitforge::Commit>,
|
||||||
net: &kxio::network::Network,
|
net: &kxio::network::Network,
|
|
@ -1,7 +1,7 @@
|
||||||
use kxio::network::{self, Network};
|
use kxio::network::{self, Network};
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, RepoDetails},
|
config::{BranchName, RepoDetails},
|
||||||
gitforge::ForgeFileError,
|
gitforge::ForgeFileError,
|
||||||
};
|
};
|
|
@ -8,7 +8,7 @@ use actix::prelude::*;
|
||||||
use kxio::network::{self, Network};
|
use kxio::network::{self, Network};
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
actors::repo::{RepoActor, StartMonitoring, ValidateRepo},
|
actors::repo::{RepoActor, StartMonitoring, ValidateRepo},
|
||||||
config::{BranchName, GitDir, RepoConfig, RepoDetails},
|
config::{BranchName, GitDir, RepoConfig, RepoDetails},
|
||||||
git,
|
git,
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::server::{
|
use crate::{
|
||||||
actors::repo::RepoActor,
|
actors::repo::RepoActor,
|
||||||
config::{BranchName, GitDir, RepoConfig},
|
config::{BranchName, GitDir, RepoConfig},
|
||||||
gitforge::{self, RepoCloneError, Repository},
|
gitforge::{self, RepoCloneError, Repository},
|
|
@ -16,7 +16,7 @@ pub use types::*;
|
||||||
mod errors;
|
mod errors;
|
||||||
pub use errors::*;
|
pub use errors::*;
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, GitDir, RepoConfig, RepoDetails},
|
config::{BranchName, GitDir, RepoConfig, RepoDetails},
|
||||||
types::{GitRef, MessageToken},
|
types::{GitRef, MessageToken},
|
||||||
};
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{
|
config::{
|
||||||
ApiToken, BranchName, ForgeDetails, ForgeName, ForgeType, GitDir, Hostname, RepoAlias,
|
ApiToken, BranchName, ForgeDetails, ForgeName, ForgeType, GitDir, Hostname, RepoAlias,
|
||||||
RepoBranches, RepoConfig, RepoConfigSource, RepoDetails, RepoPath, User,
|
RepoBranches, RepoConfig, RepoConfigSource, RepoDetails, RepoPath, User,
|
|
@ -2,7 +2,7 @@ use assert2::let_assert;
|
||||||
|
|
||||||
use kxio::network::{MockNetwork, StatusCode};
|
use kxio::network::{MockNetwork, StatusCode};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, ForgeType, RepoConfigSource},
|
config::{BranchName, ForgeType, RepoConfigSource},
|
||||||
types::ServerGeneration,
|
types::ServerGeneration,
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{ops::Deref as _, path::PathBuf, sync::atomic::AtomicBool};
|
use std::{ops::Deref as _, path::PathBuf, sync::atomic::AtomicBool};
|
||||||
|
|
||||||
use crate::server::{
|
use crate::{
|
||||||
config::{BranchName, RepoDetails},
|
config::{BranchName, RepoDetails},
|
||||||
gitforge::RepoCloneError,
|
gitforge::RepoCloneError,
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ impl Branch {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Force {
|
pub enum Force {
|
||||||
No,
|
No,
|
||||||
From(crate::server::types::GitRef),
|
From(crate::types::GitRef),
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for Force {
|
impl std::fmt::Display for Force {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
@ -30,7 +30,7 @@ impl std::fmt::Display for Force {
|
||||||
#[derive(Debug, derive_more::From, derive_more::Display)]
|
#[derive(Debug, derive_more::From, derive_more::Display)]
|
||||||
pub enum BranchResetError {
|
pub enum BranchResetError {
|
||||||
Open(Box<gix::open::Error>),
|
Open(Box<gix::open::Error>),
|
||||||
Fetch(crate::server::gitforge::forgejo::branch::fetch::Error),
|
Fetch(crate::gitforge::forgejo::branch::fetch::Error),
|
||||||
Push,
|
Push,
|
||||||
}
|
}
|
||||||
impl std::error::Error for BranchResetError {}
|
impl std::error::Error for BranchResetError {}
|
|
@ -6,18 +6,15 @@ pub mod types;
|
||||||
|
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use kxio::network::Network;
|
use kxio::{fs::FileSystem, network::Network};
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use tracing::{error, info, level_filters::LevelFilter};
|
use tracing::{error, info, level_filters::LevelFilter};
|
||||||
|
|
||||||
use crate::{
|
use crate::actors::{
|
||||||
fs::FileSystem,
|
|
||||||
server::actors::{
|
|
||||||
file_watcher::{self, FileUpdated},
|
file_watcher::{self, FileUpdated},
|
||||||
server::Server,
|
server::Server,
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn init(fs: FileSystem) {
|
pub fn init(fs: FileSystem) {
|
||||||
|
@ -33,7 +30,7 @@ pub fn init(fs: FileSystem) {
|
||||||
file_name
|
file_name
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
match fs.file_write(&pathbuf, include_str!("../../../../server-default.toml")) {
|
match fs.file_write(&pathbuf, include_str!("../../../server-default.toml")) {
|
||||||
Ok(_) => println!("Created a default configuration file at {}", file_name),
|
Ok(_) => println!("Created a default configuration file at {}", file_name),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Failed to write to the configuration file: {}", e)
|
eprintln!("Failed to write to the configuration file: {}", e)
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use crate::server::{config::BranchName, gitforge};
|
use crate::{config::BranchName, gitforge};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub struct GitRef(pub String);
|
pub struct GitRef(pub String);
|
Loading…
Reference in a new issue