Skip to content

Commit

Permalink
fix build environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotoNomad0 committed Dec 14, 2023
1 parent c772c10 commit 792789a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ set_env_var() {
}

# Call the function to set the environment variables
set_env_var $ENV_FILE NEXT_PUBLIC_BUILD_NUMBER $BUILD_NUMBER
set_env_var $ENV_FILE NEXT_PUBLIC_BUILD_BRANCH $BRANCH
set_env_var $ENV_FILE NEXT_PUBLIC_BUILD_CONTEXT $CONTEXT
set_env_var $ENV_FILE VITE_PUBLIC_BUILD_NUMBER $BUILD_NUMBER
set_env_var $ENV_FILE VITE_PUBLIC_BUILD_BRANCH $BRANCH
set_env_var $ENV_FILE VITE_PUBLIC_BUILD_CONTEXT $CONTEXT

echo "Environment file new contents: $(cat $ENV_FILE)"

Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function Layout({
let server_ = (serverID_ === QA) ? QA_BASE_URL : BASE_URL

if (params.get('server')?.length === 0){
server_ = (import.meta.env.NEXT_PUBLIC_BUILD_CONTEXT === 'production') ? BASE_URL : QA_BASE_URL
server_ = (import.meta.env.VITE_PUBLIC_BUILD_CONTEXT === 'production') ? BASE_URL : QA_BASE_URL
serverID_ = (server_ === QA_BASE_URL) ? QA : PROD
}

Expand Down
2 changes: 1 addition & 1 deletion src/context/AuthContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const AuthContext = createContext({})
export default function AuthContextProvider(props) {
const [authentication, setAuthentication] = useState(null)
const [networkError, setNetworkError] = useState(null)
const defaultServer = (import.meta.env.NEXT_PUBLIC_BUILD_CONTEXT === 'production') ? BASE_URL : QA_BASE_URL
const defaultServer = (import.meta.env.VITE_PUBLIC_BUILD_CONTEXT === 'production') ? BASE_URL : QA_BASE_URL
const [server, setServer] = useLocalStorage(SERVER_KEY, defaultServer)

/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getCommitHash() {
let commitHash

try {
commitHash = import.meta.env.NEXT_PUBLIC_BUILD_NUMBER
commitHash = import.meta.env.VITE_PUBLIC_BUILD_NUMBER
} catch (e) {
console.error(`getCommitHash() - could not get commit hash`, e)
}
Expand Down

0 comments on commit 792789a

Please sign in to comment.