-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
55 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
BEARER_TOKEN= | ||
NODE_PROVIDER_API_KEY= | ||
COINCAP_API_KEY= | ||
TWITTER_OAUTH2_CLIENT_ID= | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ serde_json = "1.0.105" | |
bigdecimal = "0.4.1" | ||
log = "0.4.20" | ||
chrono = "0.4.29" | ||
dotenv_codegen = "0.15.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,28 @@ | ||
use dotenv::dotenv; | ||
use log::{debug, error, info, trace, warn}; | ||
use logger::SimpleLogger; | ||
use std::error::Error; | ||
use twitter::tweet; | ||
#[macro_use] | ||
extern crate dotenv_codegen; | ||
|
||
mod api; | ||
mod db; | ||
mod logger; | ||
mod twitter; | ||
|
||
const COINCAP_API_KEY: &str = "COINCAP_API_KEY"; | ||
const NODE_PROVIDER_API_KEY: &str = "NODE_PROVIDER_API_KEY"; | ||
const TWITTER_OAUTH2_CLIENT_ID: &str = "TWITTER_OAUTH2_CLIENT_ID"; | ||
const TWITTER_OAUTH2_CLIENT_SECRET: &str = "TWITTER_OAUTH2_CLIENT_SECRET"; | ||
|
||
use log::{LevelFilter, SetLoggerError}; | ||
|
||
pub fn init() -> Result<(), SetLoggerError> { | ||
log::set_logger(&SimpleLogger).map(|()| log::set_max_level(LevelFilter::Trace)) | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn Error>> { | ||
init().unwrap(); | ||
logger::init(); | ||
check_valid_env(); | ||
info!("info"); | ||
trace!("trace"); | ||
warn!("warn"); | ||
debug!("debug"); | ||
error!("error"); | ||
// tweet("Someteaeazzhing".to_string()).await; | ||
Ok(()) | ||
} | ||
|
||
fn check_valid_env() { | ||
dotenv().ok(); | ||
std::env::var(COINCAP_API_KEY).expect("COINCAP_API_KEY must be set."); | ||
std::env::var(NODE_PROVIDER_API_KEY).expect("NODE_PROVIDER_API_KEY must be set."); | ||
std::env::var("COINCAP_API_KEY").expect("COINCAP_API_KEY must be set."); | ||
std::env::var("NODE_PROVIDER_API_KEY").expect("NODE_PROVIDER_API_KEY must be set."); | ||
// TODO These 2 are only required when doing the login, so they prob can be taken out? | ||
// Maybe this can even turn into another crate? | ||
std::env::var(TWITTER_OAUTH2_CLIENT_ID).expect("TWITTER_OAUTH2_CLIENT_ID must be set."); | ||
std::env::var(TWITTER_OAUTH2_CLIENT_SECRET).expect("TWITTER_OAUTH2_CLIENT_SECRET must be set."); | ||
} | ||
/* | ||
mod rpc; | ||
mod starknet; | ||
fn main() -> sc_cli::Result<()> { | ||
command::run() | ||
std::env::var("TWITTER_OAUTH2_CLIENT_ID").expect("TWITTER_OAUTH2_CLIENT_ID must be set."); | ||
std::env::var("TWITTER_OAUTH2_CLIENT_SECRET") | ||
.expect("TWITTER_OAUTH2_CLIENT_SECRET must be set."); | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters