forked from baron/baron-sso
make dev/dev-debug 구분.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
const _compileTimeEnv = {
|
||||
'APP_ENV': String.fromEnvironment('APP_ENV'),
|
||||
'CLIENT_LOG_DEBUG': String.fromEnvironment('CLIENT_LOG_DEBUG'),
|
||||
'USERFRONT_DEBUG_LOG': String.fromEnvironment('USERFRONT_DEBUG_LOG'),
|
||||
};
|
||||
|
||||
String runtimeOriginFallback() {
|
||||
try {
|
||||
final origin = Uri.base.origin;
|
||||
@@ -11,14 +17,18 @@ String runtimeOriginFallback() {
|
||||
}
|
||||
|
||||
String envOrDefault(String key, String fallback) {
|
||||
if (!dotenv.isInitialized) {
|
||||
return fallback;
|
||||
if (dotenv.isInitialized) {
|
||||
final value = dotenv.env[key];
|
||||
if (value != null && value.trim().isNotEmpty) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
final value = dotenv.env[key];
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
return fallback;
|
||||
|
||||
final compileTimeValue = _compileTimeEnv[key];
|
||||
if (compileTimeValue != null && compileTimeValue.trim().isNotEmpty) {
|
||||
return compileTimeValue;
|
||||
}
|
||||
return value;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
String sanitizedUrl(String value) {
|
||||
|
||||
Reference in New Issue
Block a user