Skip to content

Commit 44eb91d

Browse files
Update Readme for HMAC
Signed-off-by: Florian Wagner <[email protected]>
1 parent 8de3818 commit 44eb91d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ pip install frequenz-client-reporting==$VERSION
3939

4040
```python
4141
from datetime import datetime, timedelta
42+
import os
4243

4344
from frequenz.client.common.metric import Metric
4445
from frequenz.client.reporting import ReportingApiClient
4546

4647
# Change server address
4748
SERVER_URL = "grpc://replace-this-with-your-server-url:port"
48-
API_KEY = open('api_key.txt').read().strip()
49-
client = ReportingApiClient(server_url=SERVER_URL, key=API_KEY)
49+
AUTH_KEY = os.environ['REPORTING_API_AUTH_KEY'].strip()
50+
# It is recommended to use a proper secret store to get the secret
51+
# For local development, make sure not to leave it in the shell history
52+
SIGN_SECRET= os.environ['REPORTING_API_SIGN_SECRET'].strip()
53+
client = ReportingApiClient(server_url=SERVER_URL, auth_key=AUTH_KEY, sign_secret=SIGN_SECRET)
5054
```
5155

5256
Besides the `microgrid_id`, `component_id`s, `metrics`, start, and end time,
@@ -157,7 +161,8 @@ microgrid component data from the reporting API.
157161
```bash
158162
reporting-cli \
159163
--url localhost:4711 \
160-
--key=$(<api_key.txt)
164+
--auth_key=$AUTH_KEY
165+
--sign_secret=$SIGN_SECRET
161166
--mid 42 \
162167
--cid 23 \
163168
--metrics AC_ACTIVE_POWER AC_REACTIVE_POWER \

RELEASE_NOTES.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
* The `key` parameter of the client has been renamed to `auth_key`
1010

1111
## New Features
1212

1313
* Add HMAC generation capabilities.
14-
* The new CLI option "key" can be used to provide the server's key.
15-
* The client itself now has a "key" argument in the constructor.
14+
* The new CLI option "sign_secret" can be used to provide the server's HMAC secret.
15+
* The client itself now has a "sign_secret" argument in the constructor.
16+
* Update documentation describing how to use the above options.
1617

1718
## Bug Fixes
1819

0 commit comments

Comments
 (0)