Skip to content

Commit d62d186

Browse files
committed
Merge pull request googleapis#383 from tseaver/remove_demo_key
Delete demo keys, update demos to use same environment vars as regressions
2 parents 42a0f2d + 73885a3 commit d62d186

File tree

6 files changed

+47
-12
lines changed

6 files changed

+47
-12
lines changed

docs/datastore-quickstart.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ You can install the library quickly with ``pip``::
2121

2222
$ pip install gcloud
2323

24+
Run the demo
25+
------------
26+
27+
In order to run the demo, you need to have registred an actual ``gcloud``
28+
project and so you'll need to provide some environment variables to facilitate
29+
authentication to your project:
30+
31+
- ``GCLOUD_TESTS_PROJECT_ID``: Developers Console project ID (e.g.
32+
bamboo-shift-455).
33+
- ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to.
34+
This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``.
35+
- ``GCLOUD_TESTS_CLIENT_EMAIL``: The email for the service account you're
36+
authenticating with
37+
- ``GCLOUD_TESTS_KEY_FILE``: The path to an encrypted key file.
38+
See private key
39+
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
40+
for explanation on how to get a private key.
41+
2442
Run the
2543
`example script <https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/datastore/demo/demo.py>`_
2644
included in the package::

docs/storage-quickstart.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ You can install the library quickly with ``pip``::
1111

1212
$ pip install gcloud
1313

14+
Run the demo
15+
------------
16+
17+
In order to run the demo, you need to have registred an actual ``gcloud``
18+
project and so you'll need to provide some environment variables to facilitate
19+
authentication to your project:
20+
21+
- ``GCLOUD_TESTS_PROJECT_ID``: Developers Console project ID (e.g.
22+
bamboo-shift-455).
23+
- ``GCLOUD_TESTS_DATASET_ID``: The name of the dataset your tests connect to.
24+
This is typically the same as ``GCLOUD_TESTS_PROJECT_ID``.
25+
- ``GCLOUD_TESTS_CLIENT_EMAIL``: The email for the service account you're
26+
authenticating with
27+
- ``GCLOUD_TESTS_KEY_FILE``: The path to an encrypted key file.
28+
See private key
29+
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
30+
for explanation on how to get a private key.
31+
1432
Run the
1533
`example script <https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/storage/demo/demo.py>`_
1634
included in the package::

gcloud/datastore/demo/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import os
33
from gcloud import datastore
44

5-
__all__ = ['get_dataset', 'CLIENT_EMAIL', 'DATASET_ID', 'PRIVATE_KEY_PATH']
5+
__all__ = ['get_dataset', 'CLIENT_EMAIL', 'DATASET_ID', 'KEY_FILENAME']
66

7-
CLIENT_EMAIL = ('754762820716-gimou6egs2hq1rli7el2t621a1b04t9i'
8-
'@developer.gserviceaccount.com')
9-
DATASET_ID = 'gcloud-datastore-demo'
10-
PRIVATE_KEY_PATH = os.path.join(os.path.dirname(__file__), 'demo.key')
7+
8+
DATASET_ID = os.getenv('GCLOUD_TESTS_DATASET_ID')
9+
CLIENT_EMAIL = os.getenv('GCLOUD_TESTS_CLIENT_EMAIL')
10+
KEY_FILENAME = os.getenv('GCLOUD_TESTS_KEY_FILE')
1111

1212

1313
def get_dataset(): # pragma NO COVER
14-
return datastore.get_dataset(DATASET_ID, CLIENT_EMAIL, PRIVATE_KEY_PATH)
14+
return datastore.get_dataset(DATASET_ID, CLIENT_EMAIL, KEY_FILENAME)

gcloud/datastore/demo/demo.key

-1.69 KB
Binary file not shown.

gcloud/storage/demo/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import os
33
from gcloud import storage
44

5-
__all__ = ['get_connection', 'CLIENT_EMAIL', 'PRIVATE_KEY_PATH', 'PROJECT']
5+
__all__ = ['get_connection', 'CLIENT_EMAIL', 'KEY_FILENAME', 'PROJECT_ID']
66

7-
CLIENT_EMAIL = ('606734090113-6ink7iugcv89da9sru7lii8bs3i0obqg@'
8-
'developer.gserviceaccount.com')
9-
PRIVATE_KEY_PATH = os.path.join(os.path.dirname(__file__), 'demo.key')
10-
PROJECT = 'gcloud-storage-demo'
7+
PROJECT_ID = os.getenv('GCLOUD_TESTS_PROJECT_ID')
8+
CLIENT_EMAIL = os.getenv('GCLOUD_TESTS_CLIENT_EMAIL')
9+
KEY_FILENAME = os.getenv('GCLOUD_TESTS_KEY_FILE')
1110

1211

1312
def get_connection(): # pragma NO COVER.
14-
return storage.get_connection(PROJECT, CLIENT_EMAIL, PRIVATE_KEY_PATH)
13+
return storage.get_connection(PROJECT_ID, CLIENT_EMAIL, KEY_FILENAME)

gcloud/storage/demo/demo.key

-1.69 KB
Binary file not shown.

0 commit comments

Comments
 (0)