Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2027)

Unified Diff: app/bin/tools_common.dart

Issue 2840533002: Add a helper function to ensure we have the correct datastore installed
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/bin/server_common.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/bin/tools_common.dart
diff --git a/app/bin/tools_common.dart b/app/bin/tools_common.dart
index 50d5d81bb8adde651a247ec701bb2851849d6f37..d3e7bfdbe8ff08390dcf18d259666622ad40b9cb 100644
--- a/app/bin/tools_common.dart
+++ b/app/bin/tools_common.dart
@@ -6,6 +6,7 @@ import 'dart:io';
import 'dart:async';
import 'package:appengine/appengine.dart';
+import 'package:gcloud/db.dart';
import 'package:gcloud/service_scope.dart';
import 'package:pub_dartlang_org/upload_signer_service.dart';
@@ -13,27 +14,16 @@ import 'server_common.dart';
import 'configuration.dart';
Future withProdServices(Future fun()) {
- if (Platform.isMacOS) {
- return _withProdServices(() {
- return fork(() async {
- await initializeApiaryDatastore();
- return fun();
- });
+ return withCorrectDatastore((_) {
+ if (!Platform.environment.containsKey('GCLOUD_PROJECT') ||
+ !Platform.environment.containsKey('GCLOUD_KEY')) {
+ throw 'Missing GCLOUD_* environments for package:appengine';
+ }
+ return withAppEngineServices(() {
+ registerUploadSigner(
+ new ServiceAccountBasedUploadSigner(activeConfiguration.credentials));
+ initBackend();
+ return fun();
});
- } else {
- return _withProdServices(fun);
- }
-}
-
-Future _withProdServices(Future fun()) async {
- if (!Platform.environment.containsKey('GCLOUD_PROJECT') ||
- !Platform.environment.containsKey('GCLOUD_KEY')) {
- throw 'Missing GCLOUD_* environments for package:appengine';
- }
- return withAppEngineServices(() {
- registerUploadSigner(
- new ServiceAccountBasedUploadSigner(activeConfiguration.credentials));
- initBackend();
- return fun();
- });
+ }, null);
}
« no previous file with comments | « app/bin/server_common.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698