getPlatform static method
Gets the google cloud platform the code is running on.
Implementation
static GoogleCloudPlatform getPlatform() {
final platformOverride = Platform.environment['YUST_PLATFORM'];
if (platformOverride != null) {
switch (platformOverride) {
case 'SERVICE':
return GoogleCloudPlatform.cloudRunService;
case 'JOB':
return GoogleCloudPlatform.cloudRunJob;
default:
return GoogleCloudPlatform.local;
}
} else if (Platform.environment.containsKey('K_SERVICE')) {
return GoogleCloudPlatform.cloudRunService;
} else if (Platform.environment.containsKey('CLOUD_RUN_JOB')) {
return GoogleCloudPlatform.cloudRunJob;
} else {
return GoogleCloudPlatform.local;
}
}