Skip to content

Commit 2af59d9

Browse files
author
ilzheev
committed
VERSION 1.0.0
1 parent b6177ba commit 2af59d9

File tree

4 files changed

+95
-5
lines changed

4 files changed

+95
-5
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Factom Open API is a lightweight REST API for the Factom blockchain. It connects
4242
## Installation guides
4343

4444
- 🐳 <a href="https://github.com/DeFacto-Team/Factom-Open-API/blob/master/guides/INSTALL_DOCKER.md">Install with Docker</a>
45-
- 🛠 Install with binaries (guide under development)
45+
- 🛠 <a href="https://github.com/DeFacto-Team/Factom-Open-API/blob/master/guides/INSTALL_BINARY.md">Install with binaries</a>
4646

4747
## Clients
4848

@@ -108,5 +108,46 @@ docker exec -ti factom-open-api ./user -c=/home/app/values/config.yaml ls
108108
docker exec -ti factom-open-api ./user -c=/home/app/values/config.yaml help
109109
```
110110

111+
### You run Factom Open API as binaries
112+
113+
*By default `user` binary uses the same config as Open API binary (`<USER_FOLDER>/.foa/config.yaml`). If you use custom location for config file, please don't forget to provide it with `-c` flag in addition to all commands below.*
114+
115+
Go to the directory with `user` binary and run it via terminal:
116+
117+
```bash
118+
./user create anton
119+
```
120+
121+
You will see an access key in the terminal.
122+
By default, new users **are enabled** and **have no write limit**.
123+
124+
You can manage users with additional binary commands:
125+
126+
```bash
127+
# create user `anton` and generate API access key
128+
./user create anton
129+
130+
# disable access to API for user `anton`
131+
./user disable anton
132+
133+
# enable access to API for user `anton`
134+
./user enable anton
135+
136+
# delete user `anton`
137+
./user delete anton
138+
139+
# rotate API access key for user `anton`
140+
./user rotate-key anton
141+
142+
# set writes limit for user `anton` to `1000` // 0 for unlimited
143+
./user set-limit anton 1000
144+
145+
# show users, API keys & params
146+
./user ls
147+
148+
# show help
149+
./user help
150+
```
151+
111152
## License
112153
Factom Open API is released under the MIT License.

api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type SuccessResponsePagination struct {
5858
}
5959

6060
const (
61-
Version = "1.0.0-rc2"
61+
Version = "1.0.0"
6262
DefaultPaginationStart = 0
6363
DefaultPaginationLimit = 30
6464
DefaultSort = "desc"

guides/INSTALL_BINARY.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Installation guide for 🛠 binaries
2+
Factom Open API consists of API binary, user management binary & config file.
3+
4+
## Step 1: Prepare a database
5+
Postgres database is required for Factom Open API.
6+
You can connect to any internal/external Postgres DB by filling the config file.
7+
Please prepare DB connection credentials for the next step.
8+
9+
## Step 2: Prepare configuration file
10+
11+
### Download config template
12+
Create any folder (e.g. ~/.foa) for config and download config template into it
13+
```bash
14+
mkdir ~/.foa
15+
curl -o ~/.foa/config.yaml https://raw.githubusercontent.com/DeFacto-Team/Factom-Open-API/master/config.yaml.EXAMPLE
16+
```
17+
18+
### Introduction to config
19+
There are few sections into config file:
20+
* `api` (API params)
21+
* `store` (DB params)
22+
* `factom` (Factom params)
23+
24+
You may use custom config params: uncomment the line and put your value to override the default value.
25+
26+
#### API params
27+
By default Open API uses HTTP port 8081.<br />
28+
Log levels: `3` — Warn, `4` — Info, `5` – Debug, `6` – Debug+DB
29+
30+
#### DB params
31+
If you use Postgres DB into `foa-db` container, then use the default config.
32+
Otherwise, specify connection to your internal/external Postgres DB.
33+
34+
#### Factom params
35+
❗️ You need to fill `factom`.`esaddress` in order to use Factom Open API.<br />
36+
By default Open API is connected to <a href="https://factomd.net" target="_blank">Factom Open Node</a>, that means you don't need to setup your own node on the Factom blockchain to work with blockchain. But if you want to use your own node, you may specify it into the config.<br />
37+
38+
### Fill the config
39+
```bash
40+
nano ~/.foa/config.yaml
41+
```
42+
43+
## Step 3: Download and install Factom Open API binaries
44+
45+
46+
*By default all binaries uses the config located at `<USER_FOLDER>/.foa/config.yaml`. If you use custom location for config file, please don't forget to provide it with `-c` flag while running binaries.*
47+
```bash
48+
./foa -c=/somewhere/placed/config.yaml
49+
```

guides/INSTALL_DOCKER.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ nano ~/.foa/config.yaml
5252
## Step 3: Run Open API container
5353
If you use Postgres DB as Docker container, use the following command with `--link` flag:
5454
```bash
55-
docker run -d -p 8081:8081 --name factom-open-api --link foa-db -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0-rc2
55+
docker run -d -p 8081:8081 --name factom-open-api --link foa-db -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0
5656
```
5757

5858
If you do not use Postgres DB as Docker container, use the following command without `--link` flag:
5959
```bash
60-
docker run -d -p 8081:8081 --name factom-open-api -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0-rc2
60+
docker run -d -p 8081:8081 --name factom-open-api -v ~/.foa:/home/app/values defactoteam/factom-open-api:1.0.0
6161
```
6262

6363
1. If you changed API HTTP port into config, don't forget to edit `-p 8081:8081`.
6464
2. Check the path to config file and edit it, if you use another path, than suggested in this guide (i.e. not `~/.foa`)
65-
3. Don't use `latest` tag for docker image, it's better to install specific releases. Latest release: `1.0.0-rc2`.
65+
3. Don't use `latest` tag for docker image, it's better to install specific releases. Latest release: `1.0.0`.

0 commit comments

Comments
 (0)