Skip to content

Commit a0bb7df

Browse files
committed
fix readme
1 parent e449b96 commit a0bb7df

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
How to separate your credentials, secrets, and configurations from your source code with environment variables
1+
# How to separate your credentials, secrets, and configurations from your source code with environment variables
22
- version: 1.0
33
- Last update: Aug 2021
44
- Environment: Windows
@@ -14,7 +14,7 @@ How should we solve this issue?
1414

1515
## <a id="12factor_config"></a>Store config in the environment
1616

17-
The [Twelve-Factor App methodology](https://12factor.net/) which is one of the most influential patterns to designing scalable software-as-a-service application. The methodology [3rd factor](https://12factor.net/config) (aka Config principle) states that configuration information should be kept as environment variables and injected into the application on runtime as the following quotes:
17+
The [Twelve-Factor App methodology](https://12factor.net/) is one of the most influential patterns to designing scalable software-as-a-service applications. The methodology [3rd factor](https://12factor.net/config) (aka Config principle) states that configuration information should be kept as environment variables and injected into the application on runtime as the following quotes:
1818

1919
>An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc). This includes:
2020
>- Resource handles to the database, Memcached, and other backing services
@@ -216,11 +216,11 @@ By default, it will use find_dotenv to search for a .env file in a current direc
216216

217217
## <a id="dotenv_java"></a>dotenv with Java
218218

219-
The next section demonstrates with the [dotenv-java](https://github.com/cdimascio/dotenv-java) library. The example Java console application uses the library to store the Refinitiv Real-Time - Optimized (RTO) credentials and configurations for the application.
219+
The next section demonstrates the [dotenv-java](https://github.com/cdimascio/dotenv-java) library. The example Java console application uses the library to store the Refinitiv Real-Time - Optimized (RTO) credentials and configurations for the application.
220220

221221
### <a id="whatis_rto"></a>What is Refinitiv Real-Time - Optimized?
222222

223-
As part of the Refinitiv Data Platform, [Refinitiv Real-Time - Optimized](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api/quick-start#connecting-to-refinitiv-real-time-optimized) (formerly known as ERT in Cloud) gives you access to best in class Real Time market data delivered in the cloud. Refinitiv Real-Time - Optimized is a new delivery mechanism for RDP, using the AWS (Amazon Web Services) cloud. Once a connection to RDP is established using Refinitiv Real-Time - Optimized, data can be retrieved using [Websocket API for Pricing Streaming and Real-Time Services](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api) aka WebSocket API.
223+
As part of the Refinitiv Data Platform, [Refinitiv Real-Time - Optimized](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api/quick-start#connecting-to-refinitiv-real-time-optimized) (formerly known as ERT in Cloud) gives you access to best in class Real-Time market data delivered in the cloud. Refinitiv Real-Time - Optimized is a new delivery mechanism for RDP, using the AWS (Amazon Web Services) cloud. Once a connection to RDP is established using Refinitiv Real-Time - Optimized, data can be retrieved using [Websocket API for Pricing Streaming and Real-Time Services](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api) aka WebSocket API.
224224

225225
For more detail regarding Refinitiv Real-Time - Optimized, please see the following APIs resources:
226226
- [WebSocket API Quick Start](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api/quick-start#connecting-to-refinitiv-real-time-optimized) page.
@@ -287,7 +287,7 @@ String baseUrl = dotenv.get("RDP_BASE_URL");
287287
authUrl = baseUrl + dotenv.get("RDP_AUTH_URL");
288288
discoveryUrl = baseUrl + dotenv.get("RDP_DISCOVERY_URL");
289289
```
290-
Next, the application uses those configurations to authenticate with RDP Auth Service, get the RTO WebSocket endpoint dynamically from the Service Discovery mechanism and further connects and consume the real-time streaming data from the WebSocket server.
290+
Next, the application uses those configurations to authenticate with the RDP Auth Service, get the RTO WebSocket endpoint dynamically from the Service Discovery mechanism and further connects and consume the real-time streaming data from the WebSocket server.
291291

292292
## <a id="dotenv_docker"></a>Using Environment Variables with Docker
293293

@@ -319,19 +319,21 @@ ENV PATH=/root/.local:$PATH \
319319
```
320320
All containers from the resulting image can access the environment variables set using Dockerfile ```ENV``` instruction, unless it is replaced by the Docker run command options.
321321

322-
When you run the Docker containers from the above Docker image setting, the ```system.out.println(dotenv.get("USERNAME"));``` (Java) and ``` print('User: ', os.getenv('USERNAME'))``` (Python) will print the USERNAME information as *DOCKER_CONTAINER*.
322+
When you run the Docker containers from the above Docker image setting, the ```system.out.println(dotenv.get("USERNAME"));``` (Java) and ```print('User: ', os.getenv('USERNAME'))``` (Python) will print the USERNAME information as *DOCKER_CONTAINER*.
323323

324324
### <a id="docker_using"></a>Environment Variables with Docker Run command
325325

326-
You can use the ```--env``` (```-e``` for shorter syntax) options with the Docker run command to set the environment variable of the container.
326+
You can use the ```--env``` (```-e``` for a shorter syntax) options with the Docker run command to set the environment variable of the container. The example with the Python RDP console container is the following:
327327

328328
```
329329
docker run --env <key>=<value> IMAGE
330330
```
331331

332-
Please note that if you want to set multiple environment variables, you need to set ```--env```` multiple times
332+
Please note that if you want to set multiple environment variables, you need to set ```--env``` multiple times
333333

334334
```
335+
docker build . -t python_rdp
336+
...
335337
docker run --env USERNAME=DOCKER_CONTAINER_RUN --env RDP_USER=USER1 --env RDP_PASSWORD=PASSWORD --env RDP_APP_KEY=APP_KEY IMAGE
336338
```
337339
Alternatively, you can use the ```--env-file``` option to parse a file of environment variables (```.env``` file) to a Docker container.
@@ -356,7 +358,7 @@ docker build . -t java_rto
356358
docker run --env-file .env --name java_websocket java_rto
357359
```
358360

359-
Please note that the ```ENV``` instruction, ```--env``` and ```--env-file``` options support the normal system environment variables, you do not need to use the dotenv library with Docker.
361+
Please note that the ```ENV``` instruction, ```--env``` and ```--env-file``` options support the normal system environment variables too. The dotenv library is not required to be used with Docker.
360362

361363
#### Caution
362364

0 commit comments

Comments
 (0)