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

merge dev to test #135

Merged
merged 4 commits into from
Sep 30, 2024
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
1 change: 1 addition & 0 deletions .env-dist
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_API_URL=
VITE_API_URL_IDREF=
6 changes: 5 additions & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

# Paramètres par défaut du conteneur
export ITEM_FRONT_API_BASEURL=${ITEM_FRONT_API_BASEURL:='http://localhost:8081/'}
export ITEM_FRONT_IDREF_API_URL=${ITEM_FRONT_IDREF_API_URL:='http://localhost:8081/'}


# Remplace les placeholders dans le code généré en prod
# ITEM_PLACEHOLDER_VUE_APP_ROOT_API
# On va remplacer les placeholders depuis les JS originales
echo "-> Remplacement des placeholders venant du .env de vuejs dans la destination /usr/share/nginx/html/"
echo "-> ITEM_FRONT_API_BASEURL=${ITEM_FRONT_API_BASEURL}"
echo "-> ITEM_PLACEHOLDER_VITE_IDREF_API_URL=${ITEM_FRONT_IDREF_API_URL}"
rm -rf /usr/share/nginx/html/
cp -rf /usr/share/nginx/html.orig/ /usr/share/nginx/html/
sed -i \
"s#ITEM_PLACEHOLDER_VITE_API_URL#${ITEM_FRONT_API_BASEURL}#g" \
/usr/share/nginx/html/assets/*

sed -i \
"s#ITEM_PLACEHOLDER_VITE_IDREF_API_URL#${ITEM_FRONT_IDREF_API_URL}#g" \
/usr/share/nginx/html/assets/*

# execute nginx (cf CMD dans Dockerfile)
exec "$@"
1 change: 1 addition & 0 deletions docker/vuejs_env_placeholder
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# pour injecter une URL de l'API au moment de la création du conteneur
# et éviter ainsi d'avoir une URL de l'API en static dans l'image docker
VITE_API_URL=ITEM_PLACEHOLDER_VITE_API_URL
VITE_API_URL_IDREF=ITEM_PLACEHOLDER_VITE_IDREF_API_URL
3 changes: 1 addition & 2 deletions src/service/IdrefService.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import axios from 'axios';

export class IdrefService {
//todo: renommer le service
constructor() {
this.client = axios.create({
baseURL: 'https://www.idref.fr/services/'
baseURL: import.meta.env.VITE_API_URL_IDREF
});
}

Expand Down
Loading