Ver Fonte

Add SSL and DB_PORT envs (#247)

* Added ssl env

* Added DB_PORT

* Changed ssl option
Chirica Gheorghe há 6 anos atrás
pai
commit
94094505fb
4 ficheiros alterados com 8 adições e 2 exclusões
  1. 2 0
      .example.env
  2. 2 1
      .gitignore
  3. 1 0
      .template.env
  4. 3 1
      server/knex.ts

+ 2 - 0
.example.env

@@ -6,9 +6,11 @@ DEFAULT_DOMAIN="localhost:3000"
 
 
 # Postgres database credential details
 # Postgres database credential details
 DB_HOST=localhost
 DB_HOST=localhost
+DB_PORT=5432
 DB_NAME=postgres
 DB_NAME=postgres
 DB_USER=
 DB_USER=
 DB_PASSWORD=
 DB_PASSWORD=
+DB_SSL=false
 
 
 # ONLY NEEDED FOR MIGRATION !!1!
 # ONLY NEEDED FOR MIGRATION !!1!
 # Neo4j database credential details
 # Neo4j database credential details

+ 2 - 1
.gitignore

@@ -6,4 +6,5 @@ client/config.js
 client/old.config.js
 client/old.config.js
 server/config.js
 server/config.js
 server/old.config.js
 server/old.config.js
-production-server
+production-server
+.idea/

+ 1 - 0
.template.env

@@ -8,6 +8,7 @@ DEFAULT_DOMAIN={{DEFAULT_DOMAIN}}
 DB_URI={{DB_URI}}
 DB_URI={{DB_URI}}
 DB_USERNAME={{DB_USERNAME}}
 DB_USERNAME={{DB_USERNAME}}
 DB_PASSWORD={{DB_PASSWORD}}
 DB_PASSWORD={{DB_PASSWORD}}
+DB_SSL={{DB_SSL}}
 
 
 # Redis host and port
 # Redis host and port
 REDIS_DISABLED={{REDIS_DISABLED}}
 REDIS_DISABLED={{REDIS_DISABLED}}

+ 3 - 1
server/knex.ts

@@ -10,9 +10,11 @@ const db = knex({
   client: "postgres",
   client: "postgres",
   connection: {
   connection: {
     host: process.env.DB_HOST,
     host: process.env.DB_HOST,
+    port: Number(process.env.DB_PORT) || 5432,
     database: process.env.DB_NAME,
     database: process.env.DB_NAME,
     user: process.env.DB_USER,
     user: process.env.DB_USER,
-    password: process.env.DB_PASSWORD
+    password: process.env.DB_PASSWORD,
+    ssl: process.env.DB_SSL === "true"
   }
   }
 });
 });