瀏覽代碼

:gear: tweaking sample dnv for more realistic deployment settings

tags/0.0.3^2
j 3 年之前
父節點
當前提交
10d60057f4
共有 2 個檔案被更改,包括 32 行新增11 行删除
  1. 22
    8
      backend/.env.sample
  2. 10
    3
      backend/server/manifest.js

+ 22
- 8
backend/.env.sample 查看文件

@@ -1,20 +1,34 @@
1 1
 # Rename me to .env then fill me with runtime configuration and credentials
2 2
 # Just don't try to check me into your repo :)
3 3
 # Confused? See https://github.com/motdotla/dotenv
4
-#
5
-# e.g.
4
+
5
+# API host:port
6 6
 API_HOST=localhost
7 7
 API_PORT=3001
8
-APP_SECRET=mysecret
9 8
 
10 9
 USE_LOCAL_DB=true
10
+DB_TYPE=mysql
11 11
 
12
-DB_ROOT_PASSWORD=root
13
-DB_USER=root
14
-DB_NAME=test
12
+
13
+# Extra pepper for auth encryption
14
+PEPPER=kosho
15
+APP_SECRET=mysecret
16
+
17
+
18
+# Config for local test dB
15 19
 DB_HOST=localhost
16
-DB_TYPE=mysql
17 20
 DB_PORT=3307
21
+DB_NAME=test
22
+
23
+DB_USER=root
24
+DB_ROOT_PASSWORD=root
18 25
 
26
+
27
+# Config for remote planet scale production dB
28
+PSCALE_DB_HOST=planet-scale-db
29
+PSCALE_DB_PORT=3306
30
+PSCALE_DB_NAME=pscale-db
19 31
 PSCALE_DB_BRANCH=main
20
-PSCALE_DB_NAME=planet-scale-db
32
+
33
+PSCALE_DB_USER=myuserpleasechange
34
+PSCALE_DB_PASSWORD=pscale_pw_abc123efg456hij789

+ 10
- 3
backend/server/manifest.js 查看文件

@@ -41,13 +41,13 @@ const _current = {
41 41
 /** Glue manifest as a confidence store */
42 42
 module.exports = new Confidence.Store({
43 43
     server: {
44
-        host: _current.host,
44
+        host: process.env.API_HOST,
45 45
         port: {
46 46
             $filter: 'NODE_ENV',
47 47
             $default: {
48 48
                 $param: 'API_PORT',
49 49
                 $coerce: 'number',
50
-                $default: _current.port,
50
+                $default: process.env.API_PORT,
51 51
             },
52 52
             test: { $value: undefined }, // Let the server find an open port
53 53
         },
@@ -105,7 +105,14 @@ module.exports = new Confidence.Store({
105 105
                         knex: {
106 106
                             client: confs.dbFlavor,
107 107
                             useNullAsDefault: true,
108
-                            connection: _current,
108
+                            connection: {
109
+                                database: _current.database,
110
+                                host: _current.host,
111
+                                port: _current.port,
112
+                                ssl: _current.ssl,
113
+                                user: _current.user,
114
+                                password: _current.password,
115
+                            },
109 116
                         },
110 117
                     },
111 118
                     production: {

Loading…
取消
儲存