Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix load ssl route error #238

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/gateway-controller/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as express from 'express'
import Config from './config'
import {logger} from './support/logger'
import {DatabaseAgent} from './support/db'
import {start_scheduler} from './scheduler'
import {initBaseRoute, initBaseSSL} from "./support/apisix-gateway-init";
import { logger } from './support/logger'
import { DatabaseAgent } from './support/db'
import { start_scheduler } from './scheduler'
import { initBaseRoute, initBaseSSL } from "./support/apisix-gateway-init"

DatabaseAgent.init(Config.SYS_DB_URI)

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

// init base ssl
if (Config.APP_SERVICE_DEPLOY_URL_SCHEMA) {
if (Config.APP_SERVICE_DEPLOY_URL_SCHEMA === 'https') {
initBaseSSL()
}

Expand Down
20 changes: 11 additions & 9 deletions packages/gateway-controller/src/support/apisix-gateway-init.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* init base route
*/
import Config from "../config";
import {ApiSixHttpUtils} from "./apisix-gateway-utils";
import {logger} from "./logger";
import Config from "../config"
import { ApiSixHttpUtils } from "./apisix-gateway-utils"
import { logger } from "./logger"

const fs = require('fs');
const fs = require('fs')

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

Expand All @@ -28,10 +28,12 @@ export async function initBaseSSL() {
let ssl = await getGlobalSSL()
if (ssl == null || ssl.validity_end < new Date().getTime() / 1000) {
initGlobalSSL()
initGlobalOssSSL()
}
ssl = await getGlobalOssSSL()
if (ssl == null || ssl.validity_end < new Date().getTime() / 1000) {
initGlobalSSL()
initGlobalOssSSL()
}
}, 1000 * 60 * 60 * 24)

Expand All @@ -45,7 +47,7 @@ function initSystemClientRoute() {
hosts: [Config.SYS_CLIENT_HOST],
upstream: {
type: 'roundrobin',
nodes: {'system-client:8080': 1}
nodes: { 'system-client:8080': 1 }
},
priority: 0,
timeout: {
Expand All @@ -64,7 +66,7 @@ function initAppConsoleRoute() {
hosts: [Config.SYS_CLIENT_HOST],
upstream: {
type: 'roundrobin',
nodes: {'app-console:8080': 1}
nodes: { 'app-console:8080': 1 }
},
timeout: {
connect: 600,
Expand All @@ -88,7 +90,7 @@ function initSysApiRoute() {
hosts: [Config.SYS_CLIENT_HOST],
upstream: {
type: 'roundrobin',
nodes: {'system-server:9000': 1}
nodes: { 'system-server:9000': 1 }
},
priority: 9,
timeout: {
Expand All @@ -113,7 +115,7 @@ function initOssRoute() {
hosts: [Config.DEPLOY_OSS_DOMAIN],
upstream: {
type: 'roundrobin',
nodes: {'oss:9000': 1}
nodes: { 'oss:9000': 1 }
},
timeout: {
connect: 600,
Expand All @@ -132,7 +134,7 @@ function initOssSubDomainRoute() {
hosts: ['*.' + Config.DEPLOY_OSS_DOMAIN],
upstream: {
type: 'roundrobin',
nodes: {'oss:9000': 1}
nodes: { 'oss:9000': 1 }
},
priority: 0,
timeout: {
Expand Down
2 changes: 1 addition & 1 deletion packages/system-server/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getApplicationByAppid } from "./support/application"
import { Initializer } from "./support/initializer"
import Config from "./config"
import { logger } from "./support/logger"
import {createApplicationRoute} from "./support/route";
import { createApplicationRoute } from "./support/route"


/**
Expand Down