Skip to content

Commit

Permalink
Adds more generic .env injector
Browse files Browse the repository at this point in the history
  • Loading branch information
KasparPeterson committed Apr 1, 2024
1 parent cc3237c commit 4df32f9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
11 changes: 1 addition & 10 deletions admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,7 @@ def _action_send_secrets(s):
s.send(str.encode(json.dumps({
"action": ACTION_SEND_SECRETS,
"secrets": {
"dot_env": {
"ENVIRONMENT": "production",
"OPEN_AI_API_KEY": settings.OPEN_AI_API_KEY,
"SERPER_API_KEY": settings.SERPER_API_KEY,
"CHAIN_ID": settings.CHAIN_ID,
"WEB3_RPC_URL": settings.WEB3_RPC_URL,
"ORACLE_ADDRESS": settings.ORACLE_ADDRESS,
"ORACLE_ABI_PATH": "/app/oracles/ChatOracle.json",

},
"dot_env": settings.get_dot_env(),
"gcp_creds_json": get_gcp_creds()
}
})))
Expand Down
26 changes: 25 additions & 1 deletion admin/settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
from typing import Dict

from dotenv import load_dotenv
import os

load_dotenv()

ENVIRONMENT = os.getenv("ENVIRONMENT", "production")
OPEN_AI_API_KEY = os.getenv("OPEN_AI_API_KEY", "")
SERPER_API_KEY = os.getenv("SERPER_API_KEY", "")

CHAIN_ID = os.getenv("CHAIN_ID", "")
WEB3_RPC_URL = os.getenv("WEB3_RPC_URL", "")
PRIVATE_KEY = os.getenv("PRIVATE_KEY", "")
ORACLE_ADDRESS = os.getenv("ORACLE_ADDRESS", "")
ORACLE_ABI_PATH = os.getenv("ORACLE_ABI_PATH", "")
GCS_BUCKET_NAME = os.getenv("GCS_BUCKET_NAME", "galadriel-assets")

GCS_BUCKET_NAME = os.getenv("GCS_BUCKET_NAME", "galadriel-assets")
BEARLY_API_KEY = os.getenv("BEARLY_API_KEY", "")
NFT_STORAGE_API_KEY = os.getenv("NFT_STORAGE_API_KEY", "")
GROQ_API_KEY = os.getenv("GROQ_API_KEY", "")


def get_dot_env() -> Dict:
return {
"ENVIRONMENT": "production",
"OPEN_AI_API_KEY": OPEN_AI_API_KEY,
"SERPER_API_KEY": SERPER_API_KEY,
"CHAIN_ID": CHAIN_ID,
"WEB3_RPC_URL": WEB3_RPC_URL,
"ORACLE_ADDRESS": ORACLE_ADDRESS,
"ORACLE_ABI_PATH": "/app/oracles/ChatOracle.json",
"GCS_BUCKET_NAME": GCS_BUCKET_NAME,
"BEARLY_API_KEY": BEARLY_API_KEY,
"NFT_STORAGE_API_KEY": NFT_STORAGE_API_KEY,
"GROQ_API_KEY": GROQ_API_KEY,
}

0 comments on commit 4df32f9

Please sign in to comment.