Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/doteenv #26

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions .env.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# INFRA
MONGO_URL=mongodb://127.0.0.1:27017
REDIS_URL=redis://localhost:6379

# API_KEYS
BUNGEE_API_KEY=
COVALENT_API_KEY=
COINGECKO_API_KEY=

# RPC_URLS
ETHEREUM_RPC_URL=https://rpc.ankr.com/eth
ARBITRUM_RPC_URL=https://arbitrum.llamarpc.com
OPTIMISM_RPC_URL=https://mainnet.optimism.io
BASE_RPC_URL=https://mainnet.base.org
8 changes: 4 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL }}
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
BAE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
MONGO_URL: ${{ secrets.MONGO_URL }}
REDIS_URL: ${{ secrets.REDIS_URL }}
environment: Testing

container_img_build_push_gar:
needs: [test]
needs: [ test ]
# Allow the job to fetch a GitHub ID token
permissions:
id-token: write
Expand All @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
image:
- us-docker.pkg.dev/biconomy-prod/biconomy-prod/reflux
- us-docker.pkg.dev/biconomy-prod/biconomy-prod/reflux
# LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE
# {owner}/{repo}/.github/workflows/{filename}@{ref}
uses: bcnmy/devops/.github/workflows/container_img_build_push_gar.yaml@master
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ target/

*.env
*.swp
# *.yaml
*.log
85 changes: 85 additions & 0 deletions Cargo.lock

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

15 changes: 9 additions & 6 deletions bin/reflux/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use axum::http::Method;
use clap::Parser;
use dotenv::dotenv;
use log::{debug, error, info};
use tokio::sync::Mutex;
use tower_http::cors::{Any, CorsLayer};

use account_aggregation::service::AccountAggregationService;
Expand Down Expand Up @@ -35,7 +36,9 @@ struct Args {

#[tokio::main]
async fn main() {
dotenv().expect("Failed to read .env");
if let Err(e) = dotenv() {
error!("Failed to load .env file: {}", e);
}
simple_logger::SimpleLogger::new().env().init().unwrap();

let mut args = Args::parse();
Expand Down Expand Up @@ -119,16 +122,16 @@ async fn run_solver(config: Arc<Config>) {
let erc20_instance_map = generate_erc20_instance_map(&config).unwrap();
let bungee_client = BungeeClient::new(&config.bungee.base_url, &config.bungee.api_key)
.expect("Failed to Instantiate Bungee Client");
let token_price_provider = CoingeckoClient::new(
let token_price_provider = Arc::new(Mutex::new(CoingeckoClient::new(
config.coingecko.base_url.clone(),
config.coingecko.api_key.clone(),
redis_client.clone(),
Duration::from_secs(config.coingecko.expiry_sec),
);
)));
let settlement_engine = Arc::new(SettlementEngine::new(
Arc::clone(&config),
bungee_client,
token_price_provider,
Arc::clone(&token_price_provider),
erc20_instance_map,
));

Expand Down Expand Up @@ -205,12 +208,12 @@ async fn run_indexer(config: Arc<Config>) {
let bungee_client = BungeeClient::new(&config.bungee.base_url, &config.bungee.api_key)
.expect("Failed to Instantiate Bungee Client");

let token_price_provider = CoingeckoClient::new(
let token_price_provider = Arc::new(Mutex::new(CoingeckoClient::new(
config.coingecko.base_url.clone(),
config.coingecko.api_key.clone(),
redis_provider.clone(),
Duration::from_secs(config.coingecko.expiry_sec),
);
)));

let indexer: Indexer<BungeeClient, RedisClient, RedisClient, CoingeckoClient<RedisClient>> =
Indexer::new(
Expand Down
Loading