Skip to content

Commit

Permalink
refactor(__env__): Moved environment variables to py file
Browse files Browse the repository at this point in the history
Excluded from gitignore, used for build pipeline
  • Loading branch information
Investigamer committed Jan 7, 2023
1 parent 6d2a6a1 commit c258bdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ tester.py
/proxyshop/datas/
/proxyshop/version_tracker.json
/release
/proxyshop/env.json
/proxyshop/__env__.py
/proxyshop/plugins/*
!/proxyshop/plugins/MrTeferi
!/proxyshop/plugins/SilvanMTG
16 changes: 8 additions & 8 deletions proxyshop/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import os
import json
from dataclasses import dataclass
try:
from proxyshop.__env__ import google
from proxyshop.__env__ import cloudfront
except ModuleNotFoundError:
google = ""
cloudfront = ""


@dataclass
Expand Down Expand Up @@ -181,14 +187,8 @@ def load_values(self):
self.versions = {}

# Import API Keys
try:
with open(os.path.join(self.cwd, "proxyshop/env.json"), "r", encoding="utf-8") as api_keys:
keys = json.load(api_keys)
self.google_api = keys['google']
self.cloudfront_url = keys['cloudfront']
except (FileNotFoundError, KeyError):
self.google_api = ""
self.cloudfront_url = ""
self.google_api = google
self.cloudfront_url = cloudfront

# Important paths
self.json_custom_path = os.path.join(self.cwd, "tmp\\custom.json")
Expand Down

0 comments on commit c258bdc

Please sign in to comment.