Skip to content
This repository was archived by the owner on Jul 10, 2019. It is now read-only.

Commit 1d7a7cb

Browse files
committed
🍣 chore(docker-compose): add gtmContainerId
1 parent 80d2643 commit 1d7a7cb

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

docker-compose.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
envName=docker-compose
22
internalEndpointUrl=http://host.docker.internal:5000
33
externalEndpointUrl=http://localhost:5000
4+
gtmContainerId=GTM-56L94CP

nuxt.config.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@ import routers from './src/routers/'
88

99
const pkg = require('./package')
1010

11-
// const {
12-
// NUXT_ENV_GTM_CONTAINER_ID = '',
13-
// NUXT_ENV_GTM_AUTH = '',
14-
// NUXT_ENV_GTM_PREVIEW = 'env-6',
15-
// NUXT_ENV_GTM_COOKIES_WIN = 'x'
16-
// } = process.env
1711
// Docker から渡ってくるが Nuxt アプリではなく nuxt.config で必要な環境変数
1812
const {
19-
gtmContainerId = 'GTM-56L94CP',
20-
gtmPreview = 'env-6',
21-
gtmCookiesWin = 'x'
13+
// Google Tag Manager
14+
gtmContainerId = 'GTM-56L94CP'
2215
} = process.env
2316

2417
const config: NuxtConfiguration = {
@@ -180,18 +173,15 @@ const config: NuxtConfiguration = {
180173
// https://github.com/potato4d/nuxt-client-init-module
181174
// https://qiita.com/potato4d/items/cc5d8ea24949e86f8a5b
182175
'nuxt-client-init-module',
176+
// https://github.com/nuxt-community/modules/tree/master/packages/google-tag-manager
183177
[
184178
'@nuxtjs/google-tag-manager',
185179
{
186180
id: gtmContainerId,
187181
layer: 'dataLayer',
188182
pageTracking: false,
189-
dev: false,
190-
query: {
191-
// gtm_auth: NUXT_ENV_GTM_AUTH, // eslint-disable-line @typescript-eslint/camelcase
192-
gtm_preview: gtmPreview, // eslint-disable-line @typescript-eslint/camelcase
193-
gtm_cookies_win: gtmCookiesWin // eslint-disable-line @typescript-eslint/camelcase
194-
}
183+
dev: !gtmContainerId,
184+
query: {}
195185
}
196186
],
197187
// https://github.com/samtgarson/nuxt-env

src/common/env/env.local.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const Env = {
22
envName: 'local',
33
internalEndpointUrl: 'http://localhost:5000',
4-
externalEndpointUrl: 'http://localhost:5000'
4+
externalEndpointUrl: 'http://localhost:5000',
5+
gtmContainerId: 'GTM-56L94CP'
56
}
67

78
export default Env

src/common/env/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ if (process.env.BUILD_ENV === 'docker') {
1010
Env = {
1111
envName: process.env.envName,
1212
internalEndpointUrl: process.env.internalEndpointUrl,
13-
externalEndpointUrl: process.env.externalEndpointUrl
13+
externalEndpointUrl: process.env.externalEndpointUrl,
14+
gtmContainerId: process.env.gtmContainerId
1415
} as IEnv
1516
} else {
1617
/** docker でビルドされていない場合は、 .env.local から値を取ってくる */

0 commit comments

Comments
 (0)