Skip to content

Commit 20f9329

Browse files
authored
Merge pull request #428 from AliMD/fix/storage-server
refactor(storage-server): default configs
2 parents a289d8f + d43bb9b commit 20f9329

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/service/storage-server/demo.http

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
@apiUrl = http://localhost:80
1+
@apiUrl = http://127.0.0.1:9000
22
@apiVersion = v0
3-
@token = alwatr_110_313
3+
@token = YOUR_SECRET_TOKEN
44

55
### Get a public storage over nginx serve
66
# GET {{apiUrl}}/{{apiVersion}}/public/comments/page1.json
77

88
### Get a document by storageName and docId
99
GET {{apiUrl}}/{{apiVersion}}/?storage=comments/page1&id=c1
10-
authorization: Bearer {{token}}
10+
Authorization: Bearer {{token}}
1111

1212
### Insert document
1313
PATCH {{apiUrl}}/{{apiVersion}}/?storage=comments/page1
14-
authorization: Bearer {{token}}
14+
Authorization: Bearer {{token}}
1515
Content-Type: application/json
1616

1717
{
@@ -23,7 +23,7 @@ Content-Type: application/json
2323

2424
###
2525
PATCH {{apiUrl}}/{{apiVersion}}/?storage=comments/page1
26-
authorization: Bearer {{token}}
26+
Authorization: Bearer {{token}}
2727
Content-Type: application/json
2828

2929
{
@@ -35,7 +35,7 @@ Content-Type: application/json
3535

3636
### Edit document
3737
PATCH {{apiUrl}}/{{apiVersion}}/?storage=comments/page1
38-
authorization: Bearer {{token}}
38+
Authorization: Bearer {{token}}
3939
Content-Type: application/json
4040

4141
{
@@ -47,19 +47,19 @@ Content-Type: application/json
4747

4848
### Check document exists by storageName and docId
4949
GET {{apiUrl}}/{{apiVersion}}/has?storage=comments/page1&id=c1
50-
authorization: Bearer {{token}}
50+
Authorization: Bearer {{token}}
5151

5252
### Delete document
5353
DELETE {{apiUrl}}/{{apiVersion}}/?storage=comments/page1&id=c1
54-
authorization: Bearer {{token}}
54+
Authorization: Bearer {{token}}
5555

5656
### Get keys
5757
GET {{apiUrl}}/{{apiVersion}}/keys?storage=comments/page1
58-
authorization: Bearer {{token}}
58+
Authorization: Bearer {{token}}
5959

6060
### Get all data
6161
GET {{apiUrl}}/{{apiVersion}}/all?storage=comments/page1
62-
authorization: Bearer {{token}}
62+
Authorization: Bearer {{token}}
6363

6464
### === Test other routes and errors ===
6565

@@ -77,21 +77,21 @@ TRACE {{apiUrl}}/{{apiVersion}}
7777

7878
### Document not exists
7979
GET {{apiUrl}}/{{apiVersion}}/has?storage=comments/page1&id=foo
80-
authorization: Bearer {{token}}
80+
Authorization: Bearer {{token}}
8181

8282

8383
### Get a document by storageName without id
8484
GET {{apiUrl}}/{{apiVersion}}/?storage=comments/page1
85-
authorization: Bearer {{token}}
85+
Authorization: Bearer {{token}}
8686

8787
### empty body
8888
PATCH {{apiUrl}}/{{apiVersion}}/?storage=comments/page1
89-
authorization: Bearer {{token}}
89+
Authorization: Bearer {{token}}
9090
Content-Type: application/json
9191

9292
### invalid json
9393
PATCH {{apiUrl}}/{{apiVersion}}/?storage=comments/page1
94-
authorization: Bearer {{token}}
94+
Authorization: Bearer {{token}}
9595
Content-Type: application/json
9696

9797
{

packages/service/storage-server/src/lib/config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export const logger = createLogger('service-storage');
44

55
export const config = {
66
host: process.env.HOST ?? '0.0.0.0',
7-
port: process.env.PORT != null ? +process.env.PORT : 80,
7+
port: process.env.PORT != null ? +process.env.PORT : 9000,
88
storagePath: process.env.STORAGE_PATH ?? 'db',
9-
token: process.env.TOKEN ?? 'alwatr_110_313',
9+
token: process.env.TOKEN ?? 'YOUR_SECRET_TOKEN',
1010
};
1111

1212
logger.logProperty('config', {...config, token: '***'});

0 commit comments

Comments
 (0)