diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..fdea9f9 --- /dev/null +++ b/.env.dev @@ -0,0 +1,3 @@ +VUE_APP_PM_API_BASE=https://pmapi-dev.jdb-labs.com/v0 +VUE_APP_LOG_LEVEL=TRACE +VUE_APP_API_LOG_LEVEL=ERROR diff --git a/.env.prod b/.env.prod new file mode 100644 index 0000000..ab4ceb8 --- /dev/null +++ b/.env.prod @@ -0,0 +1,3 @@ +VUE_APP_PM_API_BASE=https://pmapi.jdb-labs.com/v0 +VUE_APP_LOG_LEVEL=INFO +VUE_APP_API_LOG_LEVEL=ERROR diff --git a/Makefile b/Makefile index c09413a..4d37893 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ dist/personal-measure-api.tar.gz: dist/personal-measure-web.tar.gz: -mkdir dist - TARGET_ENV=$(TARGET_ENV) make -C web build + (TARGET_ENV=$(TARGET_ENV) ./set-env.sh make -C web build) tar czf dist/personal-measure-web-${VERSION}.tar.gz -C web/dist . cp dist/personal-measure-web-${VERSION}.tar.gz dist/personal-measure-web.tar.gz diff --git a/api/src/main/nim/personal_measure_apipkg/api.nim b/api/src/main/nim/personal_measure_apipkg/api.nim index 55737a2..ffd6b87 100644 --- a/api/src/main/nim/personal_measure_apipkg/api.nim +++ b/api/src/main/nim/personal_measure_apipkg/api.nim @@ -211,7 +211,7 @@ proc start*(ctx: PMApiContext): void = settings: port = Port(ctx.cfg.port) - appName = "/api" + appName = "/v0" routes: diff --git a/set-env.sh b/set-env.sh new file mode 100755 index 0000000..02f04e1 --- /dev/null +++ b/set-env.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [[ -z $TARGET_ENV ]]; then + echo "TARGET_ENV variable is not set." + exit 1 +fi + +export $(grep -v '^#' .env.$TARGET_ENV | xargs ) +"$@" diff --git a/web/.env.production b/web/.env.production deleted file mode 100644 index 67ce248..0000000 --- a/web/.env.production +++ /dev/null @@ -1,3 +0,0 @@ -VUE_APP_PM_API_BASE=https://pm.jdb-labs.com/api -VUE_APP_LOG_LEVEL=INFO -VUE_APP_API_LOG_LEVEL=ERROR diff --git a/web/.env.production b/web/.env.production new file mode 120000 index 0000000..4dcd7a8 --- /dev/null +++ b/web/.env.production @@ -0,0 +1 @@ +../.env.prod \ No newline at end of file diff --git a/web/vue.config.js b/web/vue.config.js index 11e3fa8..bec9341 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -8,7 +8,10 @@ const VERSION = { module.exports = { devServer: { proxy: { - '/api': { target: 'http://localhost:8081' } + '/api': { + pathRewrite: { '^/api': '/v0' }, + target: 'http://localhost:8081' + } }, host: 'localhost', disableHostCheck: true