Skip to content

Commit

Permalink
chore(deploy): add default region database conf (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Mar 6, 2023
1 parent 916ca0d commit 92e570f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions deploy/build/charts/laf-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ spec:
value: {{ .Values.apiServerUrl | quote}}
- name: JWT_EXPIRES_IN
value: {{ .Values.jwt.expires_in | quote}}
- name: DEFAULT_REGION_DATABASE_URL
value: {{ .Values.default_region.database_url | quote}}
- name: DEFAULT_REGION_MINIO_DOMAIN
value: {{ .Values.default_region.minio_domain }}
- name: DEFAULT_REGION_MINIO_EXTERNAL_ENDPOINT
Expand Down
2 changes: 2 additions & 0 deletions deploy/build/charts/laf-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ databaseUrl: ""
apiServerUrl: ""
# init default region conf
default_region:
# db conf
database_url: ""
# minio conf
minio_domain: ""
minio_external_endpoint: ""
Expand Down
1 change: 1 addition & 0 deletions deploy/build/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ helm install server -n ${NAMESPACE} \
--set casdoor.client_id=${CASDOOR_CLIENT_ID} \
--set casdoor.client_secret=${CASDOOR_CLIENT_SECRET} \
--set casdoor.redirect_uri=${CASDOOR_REDIRECT_URI} \
--set default_region.database_url=${DATABASE_URL} \
--set default_region.minio_domain=${MINIO_DOMAIN} \
--set default_region.minio_external_endpoint=${MINIO_EXTERNAL_ENDPOINT} \
--set default_region.minio_internal_endpoint=${MINIO_INTERNAL_ENDPOINT} \
Expand Down
5 changes: 5 additions & 0 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ export class ServerConfig {
return process.env.API_SERVER_URL || 'http://localhost:3000'
}

/** default region conf */
static get DEFAULT_REGION_DATABASE_URL() {
return process.env.DEFAULT_REGION_DATABASE_URL
}

static get DEFAULT_REGION_RUNTIME_DOMAIN() {
return process.env.DEFAULT_REGION_RUNTIME_DOMAIN || 'localhost'
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/initializer/initializer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class InitializerService {
databaseConf: {
set: {
driver: 'mongodb',
connectionUri: ServerConfig.DATABASE_URL,
connectionUri: ServerConfig.DEFAULT_REGION_DATABASE_URL,
},
},
storageConf: {
Expand Down

0 comments on commit 92e570f

Please sign in to comment.