make wasmcloud a library

This commit is contained in:
Cadey Ratio 2020-10-30 20:38:00 -04:00
parent 8edb279f4e
commit 102f6654a9
3 changed files with 37 additions and 27 deletions

View File

@ -10,7 +10,6 @@ edition = "2018"
blake3 = "0.3"
chrono = { version = "0.4", features = ["serde"] }
color-eyre = "0.5"
diesel = { version = "1", features = ["postgres", "r2d2", "uuidv07", "chrono"] }
elfs = "0"
hex = "0"
hmac = "0.9"
@ -31,6 +30,10 @@ uuid = { version = "0.7", features = ["serde", "v4"] }
rocket_upload = { path = "./lib/rocket_upload" }
[dependencies.diesel]
version = "1"
features = ["postgres", "r2d2", "uuidv07", "chrono"]
[dependencies.rocket_contrib]
version = "0.4"
default-features = false

32
src/lib.rs Normal file
View File

@ -0,0 +1,32 @@
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
#[macro_use]
extern crate tracing;
use diesel::pg::PgConnection;
pub mod api;
pub mod b2;
pub mod gitea;
pub mod jwt;
pub mod models;
pub mod schema;
#[database("main_data")]
pub struct MainDatabase(PgConnection);
pub struct Gitea;
// Name your user agent after your app?
pub static APP_USER_AGENT: &str = concat!(
env!("CARGO_PKG_NAME"),
"/",
env!("CARGO_PKG_VERSION"),
" +https://tulpa.dev/wasmcloud/wasmcloud",
);

View File

@ -1,38 +1,13 @@
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
#[macro_use]
extern crate tracing;
use color_eyre::eyre::Result;
use diesel::pg::PgConnection;
use rocket_contrib::helmet::SpaceHelmet;
use rocket_oauth2::OAuth2;
pub mod api;
pub mod b2;
pub mod gitea;
pub mod jwt;
pub mod models;
pub mod schema;
#[database("main_data")]
pub struct MainDatabase(PgConnection);
pub struct Gitea;
// Name your user agent after your app?
pub static APP_USER_AGENT: &str = concat!(
env!("CARGO_PKG_NAME"),
"/",
env!("CARGO_PKG_VERSION"),
" +https://tulpa.dev/wasmcloud/api",
);
use ::wasmcloud::{api, b2, gitea, jwt, Gitea, MainDatabase};
fn main() -> Result<()> {
color_eyre::install()?;