move xfay app secret to .env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
randogoth 2026-06-08 12:38:31 +03:00
parent 0596fdec27
commit 3cafc4456c
4 changed files with 29 additions and 5 deletions

18
test/test_env.dart Normal file
View file

@ -0,0 +1,18 @@
import 'dart:io';
/// Loads KEY=VALUE pairs from a `.env` file at the project root.
/// Lines starting with `#` and blank lines are ignored.
/// Returns an empty map if the file does not exist.
Map<String, String> loadEnv() {
final file = File('.env');
if (!file.existsSync()) return {};
final result = <String, String>{};
for (final line in file.readAsLinesSync()) {
final trimmed = line.trim();
if (trimmed.isEmpty || trimmed.startsWith('#')) continue;
final idx = trimmed.indexOf('=');
if (idx < 1) continue;
result[trimmed.substring(0, idx).trim()] = trimmed.substring(idx + 1).trim();
}
return result;
}