{"action":"opened","issue":{"url":"https://api.github.com/repos/angular-fullstack/generator-angular-fullstack/issues/2710","repository_url":"https://api.github.com/repos/angular-fullstack/generator-angular-fullstack","labels_url":"https://api.github.com/repos/angular-fullstack/generator-angular-fullstack/issues/2710/labels{/name}","comments_url":"https://api.github.com/repos/angular-fullstack/generator-angular-fullstack/issues/2710/comments","events_url":"https://api.github.com/repos/angular-fullstack/generator-angular-fullstack/issues/2710/events","html_url":"https://github.com/angular-fullstack/generator-angular-fullstack/issues/2710","id":315733675,"number":2710,"title":"shared.js exports incorrectly and no longer copies process.env variables","user":{"login":"rohanrichards","id":16222002,"avatar_url":"https://avatars2.githubusercontent.com/u/16222002?v=4","gravatar_id":"","url":"https://api.github.com/users/rohanrichards","html_url":"https://github.com/rohanrichards","followers_url":"https://api.github.com/users/rohanrichards/followers","following_url":"https://api.github.com/users/rohanrichards/following{/other_user}","gists_url":"https://api.github.com/users/rohanrichards/gists{/gist_id}","starred_url":"https://api.github.com/users/rohanrichards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohanrichards/subscriptions","organizations_url":"https://api.github.com/users/rohanrichards/orgs","repos_url":"https://api.github.com/users/rohanrichards/repos","events_url":"https://api.github.com/users/rohanrichards/events{/privacy}","received_events_url":"https://api.github.com/users/rohanrichards/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-19T05:35:02Z","updated_at":"2018-04-19T05:35:02Z","closed_at":null,"author_association":"NONE","body":" - [x] I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.\r\n\r\nItem | Version\r\n----- | -----\r\ngenerator-angular-fullstack | 5.0.0-beta.3\r\nNode | 9.8.0\r\nnpm | 5.6.0\r\nOperating System | Windows 10\r\n\r\nItem | Answer\r\n----- | -----\r\nTranspiler | TypeScript\r\nMarkup | HTML\r\nCSS | SCSS\r\nRouter | ?\r\nClient Tests | Mocha\r\nDB | MongoDB\r\nAuth | Y\r\n\r\nWhen accessing constants like so\r\n`import constants from './app.constants';`\r\nThe object is defined with this structure:\r\n```\r\ndefaults: {\r\n  env:\r\n  etc\"\r\n}\r\n```\r\nWithin `app.module.ts` an if statement appears which ads an injectable to the app (I don't understand what it does)\r\n```\r\nif (constants.env === 'development') {\r\n\t@Injectable()\r\n\tclass HttpOptions extends BaseRequestOptions {\r\n\t\tmerge(options: RequestOptionsArgs): RequestOptions {\r\n\t\t\toptions.url = `http://localhost:9000${options.url}`;\r\n\t\t\treturn super.merge(options);\r\n\t\t}\r\n\t}\r\n\r\n\tproviders.push({ provide: RequestOptions, useClass: HttpOptions });\r\n}\r\n```\r\nThe if statement always fails as `constants.env` is always undefined. The correct way to access the variable would be with `constants.default.env`\r\n\r\nWithin `server/config/environment/shared.js` the export appears as `module.exports.default` and I have changed this to remove the default. Now my constants object can be accessed as above (`constants.env`)\r\n\r\nThis works fine, however I now have a CORS error when I run my app:\r\n`CORS header ‘Access-Control-Allow-Origin’ missing`\r\nI believe this is due to the Injectable code within `app.module.ts` (commenting out the code resolves the issue).\r\n\r\nFinally, while testing shared.js I have noticed that it does not correctly import any process.env variables, and it seems the gulpfile is missing the task to copy them across. What is the appropriate way currently to get environment variables to the client side?\r\n"}}
{"actor":{"display_login":"rohanrichards"}}