mirror of
https://github.com/DefectingCat/phthonus
synced 2025-07-15 16:41:32 +00:00
feat(axum): add env file
This commit is contained in:
15
web/Rust/axum/.editorconfig
Normal file
15
web/Rust/axum/.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_size = 4
|
||||
charset = utf-8
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
1
web/Rust/axum/.env.example
Normal file
1
web/Rust/axum/.env.example
Normal file
@ -0,0 +1 @@
|
||||
PHTHONUS_PORT=4000
|
1
web/Rust/axum/.gitignore
vendored
1
web/Rust/axum/.gitignore
vendored
@ -1 +1,2 @@
|
||||
target/
|
||||
.env
|
||||
|
2
web/Rust/axum/Cargo.lock
generated
2
web/Rust/axum/Cargo.lock
generated
@ -567,7 +567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "phthonus-axum"
|
||||
name = "phthonus"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "phthonus-axum"
|
||||
name = "phthonus"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
62
web/Rust/axum/Makefile
Normal file
62
web/Rust/axum/Makefile
Normal file
@ -0,0 +1,62 @@
|
||||
CARGO = cargo
|
||||
RUSTC = rustc
|
||||
CROSS = cross
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
$(CARGO) build
|
||||
|
||||
release: clean
|
||||
$(CARGO) build --release
|
||||
|
||||
dev:
|
||||
PHTHONUS_LOG=debug $(CARGO) watch -x run
|
||||
|
||||
run:
|
||||
$(CARGO) run
|
||||
|
||||
test:
|
||||
$(CARGO) test
|
||||
|
||||
clean:
|
||||
$(CARGO) clean
|
||||
|
||||
clean-release:
|
||||
rm -rf ./target/release/
|
||||
rm -rf ./target/debug/
|
||||
|
||||
check:
|
||||
$(CARGO) check
|
||||
|
||||
format:
|
||||
$(CARGO) fmt
|
||||
|
||||
lint:
|
||||
$(CARGO) clippy
|
||||
|
||||
fix:
|
||||
$(CARGO) fix --allow-dirty --all-features && $(CARGO) fmt
|
||||
|
||||
build-linux-musl: clean-release
|
||||
$(CROSS) build --release --target x86_64-unknown-linux-musl
|
||||
|
||||
build-linux-gnu: clean-release
|
||||
$(CROSS) build --release --target x86_64-unknown-linux-gnu
|
||||
|
||||
build-windows-gnu: clean-release
|
||||
$(CROSS) build --release --target x86_64-pc-windows-gnu
|
||||
|
||||
build-freebsd: clean-release
|
||||
$(CROSS) build --release --target x86_64-unknown-freebsd
|
||||
|
||||
build-loongarch: clean-release
|
||||
$(CROSS) build --release --target loongarch64-unknown-linux-gnu
|
||||
|
||||
deps:
|
||||
python -m venv venus \
|
||||
&& source venus/bin/activate \
|
||||
&& pip install -r scripts/requirements.txt \
|
||||
&& python scripts/download-core.py
|
||||
|
||||
.PHONY: all
|
@ -22,7 +22,7 @@ async fn main() -> Result<()> {
|
||||
init_logger();
|
||||
info!("Hello, world!");
|
||||
|
||||
let port = env::var("VENUS_PORT")
|
||||
let port = env::var("PHTHONUS_PORT")
|
||||
.map(|port| port.parse::<u16>().unwrap_or(DEFAULT_PORT))
|
||||
.unwrap_or(DEFAULT_PORT);
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], port));
|
||||
|
Reference in New Issue
Block a user