mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-27 22:12:25 +00:00
Merge pull request #87 from EETagent/portfolio_env_prefix
This commit is contained in:
commit
fdf7dc66c5
3 changed files with 6 additions and 6 deletions
|
|
@ -32,7 +32,7 @@ impl sea_orm_rocket::Pool for SeaOrmPool {
|
||||||
async fn init(_figment: &Figment) -> Result<Self, Self::Error> {
|
async fn init(_figment: &Figment) -> Result<Self, Self::Error> {
|
||||||
dotenv::dotenv().ok();
|
dotenv::dotenv().ok();
|
||||||
|
|
||||||
let database_url = std::env::var("DATABASE_URL").unwrap();
|
let database_url = std::env::var("PORTFOLIO_DATABASE_URL").unwrap();
|
||||||
let mut options: ConnectOptions = database_url.into();
|
let mut options: ConnectOptions = database_url.into();
|
||||||
options
|
options
|
||||||
.max_connections(1024)
|
.max_connections(1024)
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ impl PortfolioService {
|
||||||
// Get root path or local directory
|
// Get root path or local directory
|
||||||
fn get_file_store_path() -> PathBuf {
|
fn get_file_store_path() -> PathBuf {
|
||||||
dotenv::dotenv().ok();
|
dotenv::dotenv().ok();
|
||||||
Path::new(&std::env::var("STORE_PATH").unwrap_or_else(|_| "".to_string())).to_path_buf()
|
Path::new(&std::env::var("PORTFOLIO_STORE_PATH").unwrap_or_else(|_| "".to_string())).to_path_buf()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes file to desired location
|
/// Writes file to desired location
|
||||||
|
|
@ -379,7 +379,7 @@ mod tests {
|
||||||
|
|
||||||
tokio::fs::create_dir_all(application_cache_dir.clone()).await.unwrap();
|
tokio::fs::create_dir_all(application_cache_dir.clone()).await.unwrap();
|
||||||
|
|
||||||
std::env::set_var("STORE_PATH", temp_dir.to_str().unwrap());
|
std::env::set_var("PORTFOLIO_STORE_PATH", temp_dir.to_str().unwrap());
|
||||||
|
|
||||||
(temp_dir, application_dir, application_cache_dir)
|
(temp_dir, application_dir, application_cache_dir)
|
||||||
}
|
}
|
||||||
|
|
@ -388,7 +388,7 @@ mod tests {
|
||||||
async fn clear_data_store_temp_dir(temp_dir: PathBuf) {
|
async fn clear_data_store_temp_dir(temp_dir: PathBuf) {
|
||||||
tokio::fs::remove_dir_all(temp_dir).await.unwrap();
|
tokio::fs::remove_dir_all(temp_dir).await.unwrap();
|
||||||
|
|
||||||
std::env::remove_var("STORE_PATH");
|
std::env::remove_var("PORTFOLIO_STORE_PATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
@ -398,7 +398,7 @@ mod tests {
|
||||||
let plain_text_password = "test".to_string();
|
let plain_text_password = "test".to_string();
|
||||||
|
|
||||||
let temp_dir = std::env::temp_dir().join("portfolio_test_tempdir").join("create_folder");
|
let temp_dir = std::env::temp_dir().join("portfolio_test_tempdir").join("create_folder");
|
||||||
std::env::set_var("STORE_PATH", temp_dir.to_str().unwrap());
|
std::env::set_var("PORTFOLIO_STORE_PATH", temp_dir.to_str().unwrap());
|
||||||
|
|
||||||
CandidateService::create(&db, APPLICATION_ID, &plain_text_password, "".to_string())
|
CandidateService::create(&db, APPLICATION_ID, &plain_text_password, "".to_string())
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
|
PORTFOLIO_DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
|
||||||
ports:
|
ports:
|
||||||
- "9000:8000"
|
- "9000:8000"
|
||||||
command: sh -c "cargo watch -x run"
|
command: sh -c "cargo watch -x run"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue