docker support
This commit is contained in:
parent
dfd7c6c9fd
commit
7ecba7528f
|
@ -1279,6 +1279,22 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "myoauth"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"crypto-hash",
|
||||
"futures",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tide",
|
||||
"tokio",
|
||||
"tokio-postgres",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.18"
|
||||
|
@ -1298,22 +1314,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oauth"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"crypto-hash",
|
||||
"futures",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tide",
|
||||
"tokio",
|
||||
"tokio-postgres",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.2"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "oauth"
|
||||
name = "myoauth"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -13,6 +13,6 @@ serde_json = "1.0"
|
|||
tokio = { version = "1.37.0", features = ["full"] }
|
||||
tokio-postgres = { version = "0.7.10", features = ["with-uuid-1"] }
|
||||
futures = "0.3.30"
|
||||
uuid = { verion = "1.0.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
|
||||
uuid = { version = "1.0.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
|
||||
rand = "0.8.5"
|
||||
crypto-hash = "0.3.4"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
FROM rust:1.74.1 as builder
|
||||
WORKDIR /app
|
||||
ADD . /app
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:12.5
|
||||
RUN mkdir /myoauth
|
||||
COPY --from=builder /app/target/release/myoauth /myoauth
|
||||
CMD ["/myoauth/myoauth"]
|
|
@ -0,0 +1,5 @@
|
|||
pack:
|
||||
sudo docker build -t myoauth . --no-cache
|
||||
|
||||
publish:
|
||||
sudo docker tag myoauth arielherself/myoauth && sudo docker push arielherself/myoauth
|
16
src/main.rs
16
src/main.rs
|
@ -6,10 +6,18 @@ mod misc;
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let mut b = db::OAuthDatabase::connect("localhost", 5432, "postgres", "configjson", "myoauth").await.unwrap();
|
||||
// b.init().await.unwrap();
|
||||
let u = b.trusted_register_user().await.unwrap();
|
||||
println!("Successfully registered user with uid = {}", u.user_id);
|
||||
let postgres_host = std::env::var("POSTGRES_HOST").unwrap_or(String::from("localhost"));
|
||||
let postgres_port = std::env::var("POSTGRES_PORT").unwrap_or(String::from("5432"));
|
||||
let postgres_user = std::env::var("POSTGRES_USER").unwrap_or(String::from("postgres"));
|
||||
let postgres_password = std::env::var("POSTGRES_PASSWORD").unwrap();
|
||||
loop {
|
||||
if let Ok(mut b) = db::OAuthDatabase::connect(postgres_host.as_str(), str::parse(postgres_port.as_str()).unwrap(), postgres_user.as_str(), postgres_password.as_str(), "myoauth").await {
|
||||
b.init().await.unwrap();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// let u = b.trusted_register_user().await.unwrap();
|
||||
// println!("Successfully registered user with uid = {}", u.user_id);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
Loading…
Reference in New Issue