Skip to content

Commit

Permalink
Mijago#43 Deactivated old API keys and removed them from the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Mijago committed Oct 22, 2021
1 parent 6ef604b commit 6a1cccb
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
D2AP_BUNGIE_API_KEY=
D2AP_BUNGIE_CLIENT_ID=
D2AP_BUNGIE_CLIENT_SECRET=
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ testem.log
# System Files
.DS_Store
Thumbs.db


environment.ts
environment.prod.ts
.env
.env_dev
14 changes: 14 additions & 0 deletions .run/Angular CLI Server (dev).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Angular CLI Server (dev)" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="start" />
</scripts>
<node-interpreter value="project" />
<envs>
<env name="PRODUCTION" value="0" />
</envs>
<method v="2" />
</configuration>
</component>
14 changes: 14 additions & 0 deletions .run/Build (production).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build (production)" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="build" />
</scripts>
<node-interpreter value="project" />
<envs>
<env name="PRODUCTION" value="1" />
</envs>
<method v="2" />
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/Create Config (dev).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Create Config (dev)" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="config" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
14 changes: 14 additions & 0 deletions .run/Deploy (production).run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Deploy (production)" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="deploy" />
</scripts>
<node-interpreter value="project" />
<envs>
<env name="PRODUCTION" value="1" />
</envs>
<method v="2" />
</configuration>
</component>
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ D2ArmorPicker is a small tool to min-max your armor stats with only a few clicks
Visit it here, and make sure to use the second version of the tool https://mijago.github.io/D2ArmorPicker/#/v2.

Note that Version 1 is no longer actively updated (only for important bug fixes).

# Building
1) Copy `.env_example` to `.env` and `.env_dev` and fill the missing values.
2) run `npm serve` or `npm build`
125 changes: 113 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"INSTALL": "ng add @angular/material",
"start": "ng serve --ssl",
"build": "ng build",
"deploy": "ng deploy D2ArmorPicker --base-href=/ --cname=d2armorpicker.com",
"watch": "ng build --watch --configuration development",
"config": "ts-node set-env.ts",
"start": "npm run config && ng serve --ssl",
"build": "npm run config && ng build",
"deploy": "npm run config && ng deploy D2ArmorPicker --base-href=/ --cname=d2armorpicker.com",
"watch": "npm run config && ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
Expand Down Expand Up @@ -37,12 +37,14 @@
"@angular/compiler-cli": "~12.1.2",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"dotenv": "^10.0.0",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ts-node": "^10.3.1",
"typescript": "~4.3.2"
}
}
36 changes: 36 additions & 0 deletions set-env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const writeFile = require("fs").writeFile

const production = process.env.PRODUCTION === "1"
const version = "2.0.14"

// Configure Angular `environment.ts` file path
const targetPath = production
? './src/environments/environment.prod.ts'
: './src/environments/environment.ts';
// Load node modules

require('dotenv').config({
path: production
? ".env"
: ".env_dev"
});

const data = {
version: version + (production ? "" : "-dev"),
production: production,
apiKey: process.env.D2AP_BUNGIE_API_KEY,
clientId: process.env.D2AP_BUNGIE_CLIENT_ID,
client_secret: process.env.D2AP_BUNGIE_CLIENT_SECRET,
nodeEnv: process.env.NODE_ENV
}


// `environment.ts` file structure
const envConfigFile = `export const environment = ${JSON.stringify(data, null, 2)};`;
writeFile(targetPath, envConfigFile, (err: NodeJS.ErrnoException | null) => {
if (err) {
throw console.error(err);
} else {
console.log(`Angular environment.ts file generated correctly at ${targetPath} \n`);
}
});
Empty file added src/environments/.create-dir
Empty file.
7 changes: 0 additions & 7 deletions src/environments/environment.prod.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/environments/environment.ts

This file was deleted.

0 comments on commit 6a1cccb

Please sign in to comment.