rename
This commit is contained in:
parent
3b00481425
commit
b495fc4ea2
5 changed files with 14 additions and 12 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1083,7 +1083,7 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "macnickenson"
|
||||
name = "mac4nick"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "macnickenson"
|
||||
name = "mac4nick"
|
||||
version = "0.1.0"
|
||||
authors = ["Stefan Schwarz <stefan@f2o.io>"]
|
||||
edition = "2018"
|
||||
|
|
|
@ -5,14 +5,14 @@ ADD . .
|
|||
RUN apt update && apt install -y musl-tools
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
RUN cargo build --release --target x86_64-unknown-linux-musl
|
||||
RUN find /app/target -name macnickenson
|
||||
RUN strip /app/target/x86_64-unknown-linux-musl/release/macnickenson
|
||||
RUN find /app/target -name mac4nick
|
||||
RUN strip /app/target/x86_64-unknown-linux-musl/release/mac4nick
|
||||
|
||||
# ---
|
||||
|
||||
FROM scratch
|
||||
WORKDIR /app/static
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/macnickenson /app/macnickenson
|
||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/mac4nick /app/mac4nick
|
||||
USER 1000
|
||||
CMD ["/app/macnickenson"]
|
||||
CMD ["/app/mac4nick"]
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -1,7 +1,7 @@
|
|||
use anyhow::{Context, Result};
|
||||
use argh::FromArgs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::MySqlPool;
|
||||
use std::io;
|
||||
use tide::sessions::{MemoryStore, SessionMiddleware};
|
||||
mod db;
|
||||
mod forms;
|
||||
|
@ -60,7 +60,7 @@ pub type Message = (Level, String);
|
|||
pub type Request = tide::Request<State>;
|
||||
|
||||
#[async_std::main]
|
||||
async fn main() -> Result<(), io::Error> {
|
||||
async fn main() -> Result<()> {
|
||||
let config: Config = argh::from_env();
|
||||
if config.log {
|
||||
tide::log::start();
|
||||
|
@ -68,7 +68,7 @@ async fn main() -> Result<(), io::Error> {
|
|||
|
||||
let pool = MySqlPool::connect(&config.dsn)
|
||||
.await
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, format!("{:?}", err)))?;
|
||||
.context("unable to open database connection")?;
|
||||
|
||||
let session_store =
|
||||
SessionMiddleware::new(MemoryStore::new(), config.session_secret.as_bytes());
|
||||
|
@ -80,6 +80,8 @@ async fn main() -> Result<(), io::Error> {
|
|||
app.at("/").get(routes::index);
|
||||
app.at("/change").post(routes::change);
|
||||
app.at("/healthz").get(routes::healthz);
|
||||
app.at("/static").serve_dir("static/")?;
|
||||
app.listen(config.listen).await
|
||||
app.at("/static")
|
||||
.serve_dir("static/")
|
||||
.context("unable to open static files")?;
|
||||
app.listen(config.listen).await.context("unable to listen")
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<title>macnickenson</title>
|
||||
<title>mac4nick</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue