mirror of
https://github.com/kristoferssolo/axum-template.git
synced 2025-10-21 17:20:35 +00:00
feat: add cargo generate support
This commit is contained in:
parent
db8f668b4b
commit
137ceedadd
1
.env
1
.env
@ -1 +0,0 @@
|
|||||||
DATABASE_URL=postgres://postgres:password@localhost:5432/axum-template
|
|
||||||
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
DATABASE_URL=postgres://postgres:password@localhost:5432/{{project-name}}
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/target
|
/target
|
||||||
|
.env
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "axum-template"
|
name = "{{project-name}}"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
||||||
@ -9,7 +9,7 @@ path = "src/lib.rs"
|
|||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
name = "axum-template"
|
name = "{{project-name}}"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = "0.7"
|
axum = "0.7"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ RUN apt-get update -y \
|
|||||||
&& apt-get clean -y \
|
&& apt-get clean -y \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=builder /app/target/release/axum-template axum-template
|
COPY --from=builder /app/target/release/{{project-name}} {{project-name}}
|
||||||
COPY config config
|
COPY config config
|
||||||
ENV APP_ENVIRONMENT production
|
ENV APP_ENVIRONMENT production
|
||||||
ENTRYPOINT ["./axum-template"]
|
ENTRYPOINT ["./axum-template"]
|
||||||
|
|||||||
@ -6,4 +6,4 @@ host = "127.0.0.1"
|
|||||||
port = 5432
|
port = 5432
|
||||||
username = "postgres"
|
username = "postgres"
|
||||||
password = "password"
|
password = "password"
|
||||||
database_name = "axum-template"
|
database_name = "{{project-name}}"
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use axum_template::{
|
use {{crate_name}}::{
|
||||||
config::get_config,
|
config::get_config,
|
||||||
routes::route,
|
routes::route,
|
||||||
telemetry::{get_subscriber, init_subscriber},
|
telemetry::{get_subscriber, init_subscriber},
|
||||||
@ -8,7 +8,7 @@ use tokio::net::TcpListener;
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), std::io::Error> {
|
async fn main() -> Result<(), std::io::Error> {
|
||||||
let subscriber = get_subscriber("axum-template", "info", std::io::stdout);
|
let subscriber = get_subscriber("{{project-name}}", "info", std::io::stdout);
|
||||||
init_subscriber(subscriber);
|
init_subscriber(subscriber);
|
||||||
let config = get_config().expect("Failed to read configuation.");
|
let config = get_config().expect("Failed to read configuation.");
|
||||||
let pool = PgPoolOptions::new().connect_lazy_with(config.database.with_db());
|
let pool = PgPoolOptions::new().connect_lazy_with(config.database.with_db());
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use axum_template::{
|
use {{crate_name}}::{
|
||||||
config::{get_config, DatabaseSettings},
|
config::{get_config, DatabaseSettings},
|
||||||
routes::route,
|
routes::route,
|
||||||
telemetry::{get_subscriber, init_subscriber},
|
telemetry::{get_subscriber, init_subscriber},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user