Merge pull request #87 from EETagent/portfolio_env_prefix

This commit is contained in:
Vojtěch Jungmann 2022-12-14 20:27:53 +01:00 committed by GitHub
commit fdf7dc66c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -32,7 +32,7 @@ impl sea_orm_rocket::Pool for SeaOrmPool {
async fn init(_figment: &Figment) -> Result<Self, Self::Error> {
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();
options
.max_connections(1024)

View file

@ -127,7 +127,7 @@ impl PortfolioService {
// Get root path or local directory
fn get_file_store_path() -> PathBuf {
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
@ -379,7 +379,7 @@ mod tests {
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)
}
@ -388,7 +388,7 @@ mod tests {
async fn clear_data_store_temp_dir(temp_dir: PathBuf) {
tokio::fs::remove_dir_all(temp_dir).await.unwrap();
std::env::remove_var("STORE_PATH");
std::env::remove_var("PORTFOLIO_STORE_PATH");
}
#[tokio::test]
@ -398,7 +398,7 @@ mod tests {
let plain_text_password = "test".to_string();
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())
.await

View file

@ -7,7 +7,7 @@ services:
depends_on:
- db
environment:
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
PORTFOLIO_DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
ports:
- "9000:8000"
command: sh -c "cargo watch -x run"