Skip to content

Commit

Permalink
config env
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhdanh27600 committed Sep 21, 2023
1 parent 023bdef commit f178681
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# core
NEXT_PUBLIC_BUILD_ENV="local"
DATABASE_URL="postgres://"
REDIS_AUTH="xxxxxx"
NEXT_PUBLIC_PLATFORM_AUTH="xxxxxx"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-short.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CD-Production-Short
name: CD-PRODUCTION-SHORT

# Controls when the action will run.
on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CD-Production
name: CD-PRODUCTION

# Controls when the action will run.
on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/uat.cd-short.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CD-Uat-Short
name: CD-UAT-SHORT

# Controls when the action will run.
on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/uat.cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CD-Uat
name: CD-UAT

# Controls when the action will run.
on:
Expand Down
10 changes: 9 additions & 1 deletion src/types/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export const isLocal = process.env.NEXT_PUBLIC_BUILD_ENV === 'local';
export const isUAT = process.env.NEXT_PUBLIC_BUILD_ENV === 'uat';
export const isProduction = process.env.NEXT_PUBLIC_BUILD_ENV === 'production';
export const localUrl = 'http://localhost:5000';
export const brandUrl = 'https://quickshare.at';
export const brandUrlShort = 'https://qsh.at';
export const brandUrlUat = 'https://uat.quickshare.at';
export const brandUrlShortUat = 'https://uat.qsh.at';

export const brandUrlShortDomain = 'qsh.at';
export const alternateBrandUrl = ['https://vietnamese.cloud', 'https://clickdi.top'] as const;
export const isProduction = process.env.NODE_ENV === 'production';
export const isTest = process.env.NODE_ENV === 'test';
export const cdnUrl = 'https://cdn.jsdelivr.net/gh/thanhdanh27600/quickshare@production/public';
export const GOOGLE_ADS_CLIENT_ID = 'ca-pub-5833291778924123';
Expand Down Expand Up @@ -41,6 +46,9 @@ export const baseUrl = (useShortDomain: boolean = false) => {
if (isProduction) {
return useShortDomain ? brandUrlShort : brandUrl;
}
if (isUAT) {
return useShortDomain ? brandUrlShortUat : brandUrlUat;
}
return typeof location === 'object'
? `${location.protocol}//` + location.hostname + (location.port ? ':' + location.port : '')
: localUrl;
Expand Down

0 comments on commit f178681

Please sign in to comment.