refactor: parameterize binding
This commit is contained in:
parent
b220edf508
commit
5b85c0ad8e
2
.env
2
.env
@ -5,6 +5,8 @@ DATABASE_URL=postgresql://max@localhost/brass
|
|||||||
# 64 byte long
|
# 64 byte long
|
||||||
SECRET_KEY="changeInProdOrHandAb11111111111111111111111111111111111111111111"
|
SECRET_KEY="changeInProdOrHandAb11111111111111111111111111111111111111111111"
|
||||||
HOSTNAME="localhost"
|
HOSTNAME="localhost"
|
||||||
|
ADDRESS="127.0.0.1"
|
||||||
|
PORT="8080"
|
||||||
|
|
||||||
SMTP_SERVER="localhost"
|
SMTP_SERVER="localhost"
|
||||||
SMTP_PORT="1025"
|
SMTP_PORT="1025"
|
||||||
|
@ -36,7 +36,10 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
handle_command(args.command, &pool).await?;
|
handle_command(args.command, &pool).await?;
|
||||||
|
|
||||||
println!("Starting server on http://localhost:8080.");
|
let address = env::var("ADDRESS")?;
|
||||||
|
let port = env::var("PORT")?.parse()?;
|
||||||
|
|
||||||
|
println!("Starting server on http://{address}:{port}.");
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
let generated = generate();
|
let generated = generate();
|
||||||
@ -55,7 +58,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.wrap(SessionMiddleware::new(store.clone(), secret_key.clone()))
|
.wrap(SessionMiddleware::new(store.clone(), secret_key.clone()))
|
||||||
.service(ResourceFiles::new("/static", generated))
|
.service(ResourceFiles::new("/static", generated))
|
||||||
})
|
})
|
||||||
.bind(("127.0.0.1", 8080))?
|
.bind((address, port))?
|
||||||
.run()
|
.run()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user