Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Nov 22, 2024
1 parent 02f5089 commit 3685c38
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/fetch/orderbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class OrderbookFetcher:
def _pg_engine(db_env: OrderbookEnv) -> Engine:
"""Returns a connection to postgres database"""
load_dotenv()
db_url = os.environ[f"{db_env}_DB_URL"] + "/" + os.environ["NETWORK"]
db_url = (
os.environ[f"{db_env}_DB_URL"] + "/" + os.environ.get("NETWORK", "mainnet")
)
db_string = f"postgresql+psycopg2://{db_url}"
return create_engine(db_string)

Expand Down
11 changes: 10 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ def main() -> None:
request_timeout=float(os.environ.get("DUNE_API_REQUEST_TIMEOUT", 10)),
)
orderbook = OrderbookFetcher()
web3 = Web3(Web3.HTTPProvider(os.environ.get("NODE_URL")))
network = os.environ.get("NETWORK", "mainnet")
if network == "mainnet":
node_suffix = "MAINNET"
else:
if network == "xdai":
node_suffix = "GNOSIS"
else:
if network == "arbitrum-one":
node_suffix = "ARBITRUM"
web3 = Web3(Web3.HTTPProvider(os.environ.get("NODE_URL" + "_" + node_suffix)))

if args.sync_table == SyncTable.APP_DATA:
table = os.environ["APP_DATA_TARGET_TABLE"]
Expand Down

0 comments on commit 3685c38

Please sign in to comment.