환경 로더 기본 초기화 보강
This commit is contained in:
@@ -28,8 +28,10 @@ class Environment {
|
|||||||
isProduction = envName == 'production';
|
isProduction = envName == 'production';
|
||||||
|
|
||||||
final fileName = '.env.$envName';
|
final fileName = '.env.$envName';
|
||||||
|
var initialized = false;
|
||||||
try {
|
try {
|
||||||
await dotenv.load(fileName: fileName);
|
await dotenv.load(fileName: fileName);
|
||||||
|
initialized = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
// 개발 편의를 위해 파일 미존재 시 경고만 출력하고 진행
|
// 개발 편의를 위해 파일 미존재 시 경고만 출력하고 진행
|
||||||
@@ -39,6 +41,10 @@ class Environment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!initialized) {
|
||||||
|
dotenv.testLoad();
|
||||||
|
}
|
||||||
|
|
||||||
baseUrl = dotenv.maybeGet('API_BASE_URL') ?? 'http://localhost:8080';
|
baseUrl = dotenv.maybeGet('API_BASE_URL') ?? 'http://localhost:8080';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,4 +68,3 @@ class Environment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user