Skip to content

Commit 1228f76

Browse files
authored
fix: fix use ssl route (#238)
1 parent 54b1d46 commit 1228f76

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

packages/gateway-controller/src/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as express from 'express'
22
import Config from './config'
3-
import {logger} from './support/logger'
4-
import {DatabaseAgent} from './support/db'
5-
import {start_scheduler} from './scheduler'
6-
import {initBaseRoute, initBaseSSL} from "./support/apisix-gateway-init";
3+
import { logger } from './support/logger'
4+
import { DatabaseAgent } from './support/db'
5+
import { start_scheduler } from './scheduler'
6+
import { initBaseRoute, initBaseSSL } from "./support/apisix-gateway-init"
77

88
DatabaseAgent.init(Config.SYS_DB_URI)
99

@@ -19,7 +19,7 @@ app.get('/healthz', (_req, res) => {
1919
initBaseRoute()
2020

2121
// init base ssl
22-
if (Config.APP_SERVICE_DEPLOY_URL_SCHEMA) {
22+
if (Config.APP_SERVICE_DEPLOY_URL_SCHEMA === 'https') {
2323
initBaseSSL()
2424
}
2525

packages/gateway-controller/src/support/apisix-gateway-init.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* init base route
33
*/
4-
import Config from "../config";
5-
import {ApiSixHttpUtils} from "./apisix-gateway-utils";
6-
import {logger} from "./logger";
4+
import Config from "../config"
5+
import { ApiSixHttpUtils } from "./apisix-gateway-utils"
6+
import { logger } from "./logger"
77

8-
const fs = require('fs');
8+
const fs = require('fs')
99

1010
const baseUrl = 'http://gateway:9080'
1111

@@ -28,10 +28,12 @@ export async function initBaseSSL() {
2828
let ssl = await getGlobalSSL()
2929
if (ssl == null || ssl.validity_end < new Date().getTime() / 1000) {
3030
initGlobalSSL()
31+
initGlobalOssSSL()
3132
}
3233
ssl = await getGlobalOssSSL()
3334
if (ssl == null || ssl.validity_end < new Date().getTime() / 1000) {
3435
initGlobalSSL()
36+
initGlobalOssSSL()
3537
}
3638
}, 1000 * 60 * 60 * 24)
3739

@@ -45,7 +47,7 @@ function initSystemClientRoute() {
4547
hosts: [Config.SYS_CLIENT_HOST],
4648
upstream: {
4749
type: 'roundrobin',
48-
nodes: {'system-client:8080': 1}
50+
nodes: { 'system-client:8080': 1 }
4951
},
5052
priority: 0,
5153
timeout: {
@@ -64,7 +66,7 @@ function initAppConsoleRoute() {
6466
hosts: [Config.SYS_CLIENT_HOST],
6567
upstream: {
6668
type: 'roundrobin',
67-
nodes: {'app-console:8080': 1}
69+
nodes: { 'app-console:8080': 1 }
6870
},
6971
timeout: {
7072
connect: 600,
@@ -88,7 +90,7 @@ function initSysApiRoute() {
8890
hosts: [Config.SYS_CLIENT_HOST],
8991
upstream: {
9092
type: 'roundrobin',
91-
nodes: {'system-server:9000': 1}
93+
nodes: { 'system-server:9000': 1 }
9294
},
9395
priority: 9,
9496
timeout: {
@@ -113,7 +115,7 @@ function initOssRoute() {
113115
hosts: [Config.DEPLOY_OSS_DOMAIN],
114116
upstream: {
115117
type: 'roundrobin',
116-
nodes: {'oss:9000': 1}
118+
nodes: { 'oss:9000': 1 }
117119
},
118120
timeout: {
119121
connect: 600,
@@ -132,7 +134,7 @@ function initOssSubDomainRoute() {
132134
hosts: ['*.' + Config.DEPLOY_OSS_DOMAIN],
133135
upstream: {
134136
type: 'roundrobin',
135-
nodes: {'oss:9000': 1}
137+
nodes: { 'oss:9000': 1 }
136138
},
137139
priority: 0,
138140
timeout: {

packages/system-server/src/init.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getApplicationByAppid } from "./support/application"
44
import { Initializer } from "./support/initializer"
55
import Config from "./config"
66
import { logger } from "./support/logger"
7-
import {createApplicationRoute} from "./support/route";
7+
import { createApplicationRoute } from "./support/route"
88

99

1010
/**

0 commit comments

Comments
 (0)