35 lines
954 B
Rust
35 lines
954 B
Rust
// SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
use std::net::{IpAddr, Ipv6Addr};
|
|
|
|
use clap::Parser;
|
|
|
|
/// A lightweight inventory management system
|
|
#[derive(Clone, Parser, Debug)]
|
|
#[command(version, about)]
|
|
pub struct Config {
|
|
/// Database URL of PostgreSQL database
|
|
#[arg(long, env)]
|
|
pub database_url: String,
|
|
|
|
/// Secret key for encrypting session cookie
|
|
///
|
|
/// Can be generated with head -c 64 /dev/urandom | base64 -w0
|
|
#[arg(long, env)]
|
|
pub secret_key: Option<String>,
|
|
|
|
/// Address for HTTP server to listen on
|
|
#[arg(long, env, default_value_t = IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)))]
|
|
pub listen_address: std::net::IpAddr,
|
|
|
|
/// Port for HTTP server to listen on
|
|
#[arg(long, env, default_value_t = 8080)]
|
|
pub listen_port: u16,
|
|
|
|
/// Superuser password
|
|
#[arg(long, env)]
|
|
pub superuser_password: String,
|
|
}
|