Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit ac26a4d

Browse files
committed
chore(ci): add test database url for ci
1 parent 31ecd66 commit ac26a4d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.github/workflows/rust.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v4
19+
1920
- name: Run tests
2021
run: cargo test
22+
env:
23+
DATABASE_URL: {{ secrets.DATABASE_URL }}
2124
- name: Build release
2225
run: cargo build --release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ aes.key
1919
private.pem
2020
public.pem
2121
config.json
22+
aes256.key

src/utils/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::env;
2+
13
use serde::{Deserialize, Serialize};
24
use tokio::fs::{read, write};
35

@@ -20,8 +22,9 @@ pub async fn save_config(config: Config) -> Result<(), Box<dyn std::error::Error
2022
}
2123

2224
pub async fn init_config() -> Result<(), Box<dyn std::error::Error>> {
25+
let url = env::var("DATABASE_URL").unwrap_or("mongodb://localhost:27017".to_string());
2326
let config = Config {
24-
server: "mongodb://localhost:27017".to_string(),
27+
server: url,
2528
database: "zvms".to_string(),
2629
};
2730
save_config(config).await?;

0 commit comments

Comments
 (0)