You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/cql-adapter/README.md
+40-65Lines changed: 40 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
This doc introduce the usage of CovenantSQL adapter. This adapter lets you use CovenantSQL on any platform from any programming languages using http(s) protocol. The CovenantSQL Java/Python Driver currently is based on adapter to service.
1
+
This doc introduce the usage of CovenantSQL adapter. This adapter lets you use CovenantSQL on any platform from any programming languages using http(s) protocol. The CovenantSQL Java/Python/NodeJS Driver currently is based on adapter to service.
2
2
3
3
## Prerequisites
4
4
@@ -8,80 +8,20 @@ Make sure the ```$GOPATH/bin``` is in your ```$PATH```, download build the adapt
8
8
$ go get github.com/CovenantSQL/CovenantSQL/cmd/cql-adapter
9
9
```
10
10
11
-
Adapter requires a simple ```config.yaml``` like we use in client bundled with exclusive adpater configuration.
11
+
## Adapter Usage
12
+
13
+
Adapter can use the same ```config.yaml``` and key pair with `cql`
12
14
13
15
### Generating Default Config File
14
16
15
17
First, generate the main configuration file. Same as [Generating Default Config File in Golang Client Doc](https://github.com/CovenantSQL/CovenantSQL/tree/develop/client#generating-default-config-file). An existing configuration file can also be used.
16
18
17
-
### Configure Adapter
18
-
19
-
Adapter use tls certificate for client authorization, a public or self-signed ssl certificate is required for adapter server to start. The adapter config is placed as a ```Adapter``` section of the main config file including following configurable fields.
| VerifyCertificate | bool | should adapter server verify client certificate or not<br />a client custom CA is required, all valid clients certificate should be issued by this CA | false |
27
-
| AdminCerts |[]string | each item requires to be a certificate file path<br />client with configured certificate will be granted with ADMIN privilege<br />ADMIN privilege is able to CREATE/DROP database, send WRITE/READ request ||
28
-
| WriteCerts |[]string | same format as ```AdminCerts ``` field<br />client with configured certificate will be granted with WRITE privilege<br />WRITE privilege is able to send WRITE/READ request only ||
29
-
| StorageDriver | string | two available storage driver: ```sqlite3``` and ```covenantsql```, use ```sqlite3``` driver for test purpose only ||
30
-
| StorageRoot | string | required by ```sqlite3``` storage driver, database files is placed under this root path, this path is treated as relative to working root ||
31
-
32
-
[mkcert](https://github.com/FiloSottile/mkcert) is a handy command to generate tls certificates, run the following command to generate the server certificate.
33
-
34
-
``````
35
-
$ CAROOT=$(pwd) mkcert server
36
-
Using the local CA at "/demo" ✨
37
-
Warning: the local CA is not installed in the system trust store! ⚠️
38
-
Warning: the local CA is not installed in the Firefox trust store! ⚠️
39
-
Run "mkcert -install" to avoid verification errors ‼️
40
-
41
-
Created a new certificate valid for the following names 📜
42
-
- "server"
43
-
44
-
The certificate is at "./server.pem" and the key at "./server-key.pem" ✅
45
-
46
-
And move them to ~/.cql/ dir.
47
-
``````
48
-
49
-
You can use following interactive command to generate adapter config.
50
-
51
-
```shell
52
-
$ cql-utils -tool adapterconfgen
53
-
ListenAddr (default: 0.0.0.0:4661): ⏎
54
-
CertificatePath (default: server.pem): ⏎
55
-
PrivateKeyPath (default: server-key.pem): ⏎
56
-
VerifyCertificate (default: true) (y/n): ⏎
57
-
ClientCAPath (default:): ⏎
58
-
AdminCerts (default:): ⏎
59
-
WriteCerts (default:): ⏎
60
-
StorageDriver (default: covenantsql): ⏎
61
-
StorageRoot (default:): ⏎
62
-
63
-
$ tail -n 20 ~/.cql/config.yaml
64
-
... skipping irrelevant configuration
65
-
Adapter:
66
-
ListenAddr: 0.0.0.0:4661
67
-
CertificatePath: server.pem
68
-
PrivateKeyPath: server.key
69
-
VerifyCertificate: false
70
-
ClientCAPath:
71
-
AdminCerts: []
72
-
WriteCerts: []
73
-
StorageDriver: covenantsql
74
-
StorageRoot:
75
-
```
76
-
77
-
## Adapter Usage
78
-
79
19
### Start
80
20
81
21
Start the adapter by following commands:
82
22
83
23
```shell
84
-
$ cql-adapter
24
+
$ cql-adapter -listen 127.0.0.1:4661
85
25
```
86
26
87
27
### API
@@ -117,6 +57,41 @@ $ cql-adapter
117
57
}
118
58
```
119
59
60
+
### Configure HTTPS Adapter
61
+
62
+
Adapter use tls certificate for client authorization, a public or self-signed ssl certificate is required for adapter server to start. The adapter config is placed as a ```Adapter``` section of the main config file including following configurable fields.
| VerifyCertificate | bool | should adapter server verify client certificate or not<br />a client custom CA is required, all valid clients certificate should be issued by this CA | false |
70
+
| AdminCerts |[]string | each item requires to be a certificate file path<br />client with configured certificate will be granted with ADMIN privilege<br />ADMIN privilege is able to CREATE/DROP database, send WRITE/READ request ||
71
+
| WriteCerts |[]string | same format as ```AdminCerts ``` field<br />client with configured certificate will be granted with WRITE privilege<br />WRITE privilege is able to send WRITE/READ request only ||
72
+
| StorageDriver | string | two available storage driver: ```sqlite3``` and ```covenantsql```, use ```sqlite3``` driver for test purpose only ||
73
+
| StorageRoot | string | required by ```sqlite3``` storage driver, database files is placed under this root path, this path is treated as relative to working root ||
74
+
75
+
[mkcert](https://github.com/FiloSottile/mkcert) is a handy command to generate tls certificates, run the following command to generate the server certificate.
76
+
77
+
``````
78
+
$ CAROOT=$(pwd) mkcert server
79
+
Using the local CA at "/demo" ✨
80
+
Warning: the local CA is not installed in the system trust store! ⚠️
81
+
Warning: the local CA is not installed in the Firefox trust store! ⚠️
82
+
Run "mkcert -install" to avoid verification errors ‼️
83
+
84
+
Created a new certificate valid for the following names 📜
85
+
- "server"
86
+
87
+
The certificate is at "./server.pem" and the key at "./server-key.pem" ✅
88
+
89
+
And move them to ~/.cql/ dir.
90
+
``````
91
+
92
+
You can use following interactive command to generate adapter config.
0 commit comments