Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: TT-630 Remove keys.ts to store nev variables
  • Loading branch information
nicolsss committed May 26, 2022
commit c4c875944320af5a939f09d1ed01222623f9ec50
7 changes: 5 additions & 2 deletions .github/workflows/CD-time-tracker-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ jobs:
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.stack_exchange_access_token }}
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.azure_app_configuration_connection_string }}
run: |
chmod +x ./scripts/populate-var-file.sh
sh ./scripts/populate-var-file.sh
chmod +x ./scripts/populate-keys.sh
sh ./scripts/populate-keys.sh

- name: 'run: npm install and build'
run: |
set -a
source .env
set +a
npm install
npm run build --prod --if-present
cp scripts/default-static-site.js ${BUILD_PATH}
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/CI-time-tracker-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ jobs:
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}
run: |
chmod +x ./scripts/populate-var-file.sh
sh ./scripts/populate-var-file.sh
chmod +x ./scripts/populate-keys.sh
sh ./scripts/populate-keys.sh

- name: Running tests
run: npm run ci-test --if-present
run: |
set -a
source .env
set +a
npm run ci-test --if-present
rm .env

- name: Generate coverage report
env:
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ RUN chmod -R 777 ${HOME}/time-tracker-ui

USER ${USERNAME}
RUN npm cache clean --force && npm install
EXPOSE 4200
EXPOSE 9876
CMD ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck



FROM development as build
COPY .env .
RUN npm run config && npm run build
RUN npm run build

FROM nginx:1.21 AS production

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "time-tracker",
"version": "1.72.9",
"scripts": {
"config": "ts-node ./scripts/setenv.ts",
"preinstall": "npx npm-force-resolutions",
"ng": "ng",
"start": "ng serve",
Expand Down
12 changes: 6 additions & 6 deletions scripts/populate-keys.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

> .env
echo 'AUTHORITY = '$AUTHORITY'' >> .env
echo 'CLIENT_ID = '$CLIENT_ID'' >> .env
echo 'SCOPES = '$SCOPES'' >> .env
echo 'STACK_EXCHANGE_ID = '$STACK_EXCHANGE_ID'' >> .env
echo 'STACK_EXCHANGE_ACCESS_TOKEN = '$STACK_EXCHANGE_ACCESS_TOKEN'' >> .env
echo 'AZURE_APP_CONFIGURATION_CONNECTION_STRING = '$AZURE_APP_CONFIGURATION_CONNECTION_STRING'' >> .env
echo "AUTHORITY='$AUTHORITY'" >> .env
echo "CLIENT_ID='$CLIENT_ID'" >> .env
echo "SCOPES='$SCOPES'" >> .env
echo "STACK_EXCHANGE_ID='$STACK_EXCHANGE_ID'" >> .env
echo "STACK_EXCHANGE_ACCESS_TOKEN='$STACK_EXCHANGE_ACCESS_TOKEN'" >> .env
echo "AZURE_APP_CONFIGURATION_CONNECTION_STRING='$AZURE_APP_CONFIGURATION_CONNECTION_STRING'" >> .env
cat .env
10 changes: 0 additions & 10 deletions scripts/populate-var-file.sh

This file was deleted.

33 changes: 0 additions & 33 deletions scripts/setenv.ts

This file was deleted.

13 changes: 6 additions & 7 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import * as keys from './keys';

export const environment = {
production: true,
timeTrackerApiUrl: 'https://timetracker-api.azurewebsites.net',
stackexchangeApiUrl: 'https://api.stackexchange.com',
};

export const AUTHORITY = keys.AUTHORITY;
export const CLIENT_ID = keys.CLIENT_ID;
export const SCOPES = keys.SCOPES;
export const AUTHORITY = process.env["AUTHORITY"];
export const CLIENT_ID = process.env["CLIENT_ID"];
export const SCOPES = process.env["SCOPES"].split(",");
export const ITEMS_PER_PAGE = 5;
export const STACK_EXCHANGE_ID = keys.STACK_EXCHANGE_ID;
export const STACK_EXCHANGE_ACCESS_TOKEN = keys.STACK_EXCHANGE_ACCESS_TOKEN;
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = keys.AZURE_APP_CONFIGURATION_CONNECTION_STRING;
export const STACK_EXCHANGE_ID = process.env["STACK_EXCHANGE_ID"];
export const STACK_EXCHANGE_ACCESS_TOKEN = process.env["STACK_EXCHANGE_ACCESS_TOKEN"];
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"];
export const DATE_FORMAT = 'yyyy-MM-dd';
export const DATE_FORMAT_YEAR = 'YYYY-MM-DD';
export const GROUPS = {
Expand Down
13 changes: 6 additions & 7 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
import * as keys from './keys';

export const environment = {
production: false,
timeTrackerApiUrl: 'http://localhost:7071/api',
stackexchangeApiUrl: 'https://api.stackexchange.com',
};

export const AUTHORITY = keys.AUTHORITY;
export const CLIENT_ID = keys.CLIENT_ID;
export const SCOPES = keys.SCOPES;
export const AUTHORITY = process.env["AUTHORITY"];
export const CLIENT_ID = process.env["CLIENT_ID"];
export const SCOPES = process.env["SCOPES"].split(",");
export const ITEMS_PER_PAGE = 5;
export const STACK_EXCHANGE_ID = keys.STACK_EXCHANGE_ID;
export const STACK_EXCHANGE_ACCESS_TOKEN = keys.STACK_EXCHANGE_ACCESS_TOKEN;
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = keys.AZURE_APP_CONFIGURATION_CONNECTION_STRING;
export const STACK_EXCHANGE_ID = process.env["STACK_EXCHANGE_ID"];
export const STACK_EXCHANGE_ACCESS_TOKEN = process.env["STACK_EXCHANGE_ACCESS_TOKEN"];
export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"];
export const DATE_FORMAT = 'yyyy-MM-dd';
export const DATE_FORMAT_YEAR = 'YYYY-MM-DD';
export const GROUPS = {
Expand Down
19 changes: 17 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
const webpack = require('webpack')
const { addTailwindPlugin } = require("@ngneat/tailwind");
const tailwindConfig = require("./tailwind.config.js");

module.exports = (config) => {
const config_ = {
...config,
plugins : [
...config.plugins,
new webpack.DefinePlugin({
'process.env.AUTHORITY': JSON.stringify(process.env["AUTHORITY"]),
'process.env.CLIENT_ID':JSON.stringify(process.env["CLIENT_ID"]),
'process.env.SCOPES':JSON.stringify(process.env["SCOPES"]),
'process.env.STACK_EXCHANGE_ID':JSON.stringify(process.env["STACK_EXCHANGE_ID"]),
'process.env.STACK_EXCHANGE_ACCESS_TOKEN':JSON.stringify(process.env["STACK_EXCHANGE_ACCESS_TOKEN"]),
'process.env.AZURE_APP_CONFIGURATION_CONNECTION_STRING':JSON.stringify(process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"])
})
]
}
addTailwindPlugin({
webpackConfig: config,
webpackConfig: config_,
tailwindConfig,
patchComponentsStyles: true
});
return config;
return config_;
};