mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-08-15 23:50:49 +02:00
Proper fix for building locally and through GH actions
This commit is contained in:
+3
-23
@@ -1,36 +1,16 @@
|
||||
// OpenStreetMap OAuth client IDs for this app.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
String _readFromProperties(String key) {
|
||||
final file = File('lib/keys.properties');
|
||||
if (!file.existsSync()) return '';
|
||||
|
||||
final lines = file.readAsLinesSync();
|
||||
for (final line in lines) {
|
||||
if (line.startsWith(key + '=')) {
|
||||
return line.substring(key.length + 1);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// These must be provided via --dart-define at build time.
|
||||
|
||||
String get kOsmProdClientId {
|
||||
const fromBuild = String.fromEnvironment('OSM_PROD_CLIENTID');
|
||||
if (fromBuild.isNotEmpty) return fromBuild;
|
||||
|
||||
final fromFile = _readFromProperties('OSM_PROD_CLIENTID');
|
||||
if (fromFile.isNotEmpty) return fromFile;
|
||||
|
||||
throw Exception('OSM_PROD_CLIENTID not configured');
|
||||
throw Exception('OSM_PROD_CLIENTID not configured. Use --dart-define=OSM_PROD_CLIENTID=your_id');
|
||||
}
|
||||
|
||||
String get kOsmSandboxClientId {
|
||||
const fromBuild = String.fromEnvironment('OSM_SANDBOX_CLIENTID');
|
||||
if (fromBuild.isNotEmpty) return fromBuild;
|
||||
|
||||
final fromFile = _readFromProperties('OSM_SANDBOX_CLIENTID');
|
||||
if (fromFile.isNotEmpty) return fromFile;
|
||||
|
||||
throw Exception('OSM_SANDBOX_CLIENTID not configured');
|
||||
throw Exception('OSM_SANDBOX_CLIENTID not configured. Use --dart-define=OSM_SANDBOX_CLIENTID=your_id');
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
# OpenStreetMap OAuth Client IDs
|
||||
# Copy this file to keys.properties and fill in your values for local development
|
||||
# These are used as fallback when environment variables are not provided via --dart-define.
|
||||
#
|
||||
# Get your client IDs from:
|
||||
# Production: https://www.openstreetmap.org/oauth2/applications
|
||||
# Sandbox: https://master.apis.dev.openstreetmap.org/oauth2/applications
|
||||
|
||||
OSM_PROD_CLIENTID=your_production_client_id_here
|
||||
OSM_SANDBOX_CLIENTID=your_sandbox_client_id_here
|
||||
Reference in New Issue
Block a user