Skip to content

Commit

Permalink
fix(sys): fix #96
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed May 16, 2022
1 parent f0383db commit 95e2df6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/instance-controller/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as dotenv from 'dotenv'
import { URL } from 'node:url'
dotenv.config()

/**
Expand Down Expand Up @@ -96,9 +97,12 @@ export default class Config {
* Minio configuration
*/
static get MINIO_CONFIG() {
const internal_endpoint: string = process.env.MINIO_INTERNAL_ENDPOINT
const external_endpoint: string = process.env.MINIO_EXTERNAL_ENDPOINT
// use URL().origin to get the pure hostname, because the hostname may contain port number
// this is to resolve bug of https://github.com/labring/laf/issues/96
const internal_endpoint: string = new URL(process.env.MINIO_INTERNAL_ENDPOINT).origin
const external_endpoint: string = new URL(process.env.MINIO_EXTERNAL_ENDPOINT).origin
const region: string = process.env.MINIO_REGION_NAME

return {
endpoint: {
internal: internal_endpoint,
Expand Down
9 changes: 7 additions & 2 deletions packages/system-server/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as assert from 'assert'
import * as dotenv from 'dotenv'
import { URL } from 'url'
dotenv.config()

/**
Expand Down Expand Up @@ -116,9 +117,13 @@ export default class Config {
static get MINIO_CONFIG() {
const access_key: string = process.env.MINIO_ACCESS_KEY
const access_secret: string = process.env.MINIO_ACCESS_SECRET
const internal_endpoint: string = process.env.MINIO_INTERNAL_ENDPOINT
const external_endpoint: string = process.env.MINIO_EXTERNAL_ENDPOINT

// use URL().origin to get the pure hostname, because the hostname may contain port number
// this is to resolve bug of https://github.com/labring/laf/issues/96
const internal_endpoint: string = new URL(process.env.MINIO_INTERNAL_ENDPOINT).origin
const external_endpoint: string = new URL(process.env.MINIO_EXTERNAL_ENDPOINT).origin
const region: string = process.env.MINIO_REGION_NAME

return {
access_key,
access_secret,
Expand Down

0 comments on commit 95e2df6

Please sign in to comment.