Added gitignore

This commit is contained in:
2022-10-20 21:46:33 +02:00
commit 8ca54cde57
35 changed files with 4774 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
[package]
name = "vidow_core"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.0.17", features = ["env", "derive"] }
eyre = "0.6.8"

View File

@@ -0,0 +1,55 @@
use clap::Parser;
use std::sync::Arc;
#[derive(Parser)]
pub struct AppConfigInner {
#[clap(long, env)]
pub database_url: String,
#[clap(long, env)]
pub rust_log: String,
#[clap(long, env)]
pub external_port: u32,
#[clap(long, env)]
pub internal_port: u32,
#[clap(long, env)]
pub run_migrations: bool,
#[clap(long, env)]
pub cors_origin: String,
}
pub struct AppConfig {
inner: Arc<AppConfigInner>,
}
impl AppConfig {
pub fn new() -> Self {
Self {
inner: Arc::new(AppConfigInner::parse()),
}
}
pub fn cfg(&self) -> Arc<AppConfigInner> {
self.inner.clone()
}
pub fn rust_log(&self) -> &str {
&self.inner.rust_log
}
pub fn cors_origin(&self) -> &str {
&self.inner.rust_log
}
pub fn external_port(&self) -> &u32 {
&self.inner.external_port
}
pub fn internal_port(&self) -> &u32 {
&self.inner.internal_port
}
}

View File

@@ -0,0 +1,2 @@
pub mod config;
pub use config::AppConfig;

View File

@@ -0,0 +1 @@
pub mod config;