Updates READMEs with the new config file apporach

This commit is contained in:
Sergi Delgado Segura
2020-03-23 17:12:23 +01:00
parent d21e947e05
commit d2fbcf61e3
4 changed files with 112 additions and 41 deletions

View File

@@ -2,16 +2,23 @@
`teos_cli` has some dependencies that can be satisfied by following [DEPENDENCIES.md](DEPENDENCIES.md). If your system already satisfies the dependencies, you can skip that part.
There are two ways of running `teos_cli`: adding the library to the `PYTHONPATH` env variable, or running it as a module.
There are two ways of running `teos_cli`: running it as a module or adding the library to the PYTHONPATH env variable.
## Running `teos_cli` as a module
The **easiest** way to run `teos_cli` is as a module. To do so you need to use `python -m`. From `cli` **parent** directory run:
python -m cli.teos_cli -h
Notice that if you run `teos_cli` as a module, you'll need to replace all the calls from `python teos_cli.py <argument>` to `python -m cli.teos_cli <argument>`
## Modifying `PYTHONPATH`
In order to run `teos_cli`, you should set your `PYTHONPATH` env variable to include the folder that contains the `cli` folder. You can do so by running:
**Alternatively**, you can add `teos_cli` to your `PYTHONPATH` by running:
export PYTHONPATH=$PYTHONPATH:<absolute_path_to_cli_parent>
For example, for user alice running a UNIX system and having `cli` in her home folder, she would run:
For example, for user alice running a UNIX system and having `python-teos` in her home folder, she would run:
export PYTHONPATH=$PYTHONPATH:/home/alice/
export PYTHONPATH=$PYTHONPATH:/home/alice/python-teos/
You should also include the command in your `.bashrc` to avoid having to run it every time you open a new terminal. You can do it by running:
@@ -22,14 +29,10 @@ Once the `PYTHONPATH` is set, you should be able to run `teos_cli` straightaway.
cd <absolute_path_to_cli_parent>/cli
python teos_cli.py -h
## Running `teos_cli` as a module
Python code can be also run as a module, to do so you need to use `python -m`. From `cli` **parent** directory run:
python -m cli.teos_cli -h
Notice that if you run `teos_cli` as a module, you'll need to replace all the calls from `python teos_cli.py <argument>` to `python -m cli.teos_cli <argument>`
## Modify configuration parameters
If you'd like to modify some of the configuration defaults (such as the user directory, where the logs and appointment receipts will be stored) you can do so in the config file located at:
<absolute_path_to_cli_parent>/cli/conf.py
<data_dir>/.teos_cli/teos_cli.conf
`<data_dir>` defaults to your home directory (`~`).

View File

@@ -15,8 +15,8 @@ Refer to [INSTALL.md](INSTALL.md)
#### Global options
- `-s, --server`: API server where to send the requests. Defaults to https://teos.pisa.watch (modifiable in conf.py)
- `-p, --port` : API port where to send the requests. Defaults to 443 (modifiable in conf.py)
- `-s, --server`: API server where to send the requests. Defaults to 'localhost' (modifiable in conf file).
- `-p, --port` : API port where to send the requests. Defaults to '9814' (modifiable in conf file).
- `-h --help`: shows a list of commands or help for a specific command.
#### Commands
@@ -68,7 +68,7 @@ if `-f, --file` **is** specified, then the command expects a path to a json file
### get_appointment
This command is used to get information about an specific appointment from the Eye of Satoshi.
This command is used to get information about a specific appointment from the Eye of Satoshi.
**Appointment can be in three states:**
@@ -146,8 +146,15 @@ or
If you wish to read about the underlying API, and how to write your own tool to interact with it, refer to [tEOS-API.md](TEOS-API.md).
## Are you reckless? Try me on mainnet
Would you like to try me on `mainnet` instead of `testnet`? Add `-s https://mainnet.teos.pisa.watch` to your calls, for example:
## Try our live instance
By default, `teos_cli` will connect to your local instance (running on localhost). There are also a couple of live instances running, one for mainet and one for testnet:
- testnet endpoint = `teos.pisa.watch`
- mainnet endpoint = `teosmainnet.pisa.watch`
### Connecting to the mainnet instance
Add `-s https://teosmainnet.pisa.watch` to your calls, for example:
```
python teos_cli.py -s https://teosmainnet.pisa.watch add_appointment -f dummy_appointment_data.json
@@ -155,4 +162,4 @@ python teos_cli.py -s https://teosmainnet.pisa.watch add_appointment -f dummy_ap
You can also change the config file to avoid specifying the server every time:
`DEFAULT_TEOS_API_SERVER = "https://teosmainnet.pisa.watch"`
`TEOS_SERVER = "https://teosmainnet.pisa.watch"`