This file contains hidden or 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
#[derive(Serialize, Debug)] | |
#[serde(rename_all = "camelCase")] | |
struct SignInRequest { | |
api_key: String, | |
api_secret: String, | |
} | |
#[derive(Deserialize, Debug)] | |
struct SignInResponse { | |
token: String, |
This file contains hidden or 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
#[tokio::main] | |
async fn main() -> Result<(), Error> { | |
let api_key = env::var("TMLR_API_KEY").expect("TMLR_API_KEY needs to be set"); | |
let api_secret = env::var("TMLR_API_SECRET").expect("TMLR_API_SECRET needs to be set"); | |
println!("signing in.."); | |
let token = sign_in(api_key, api_secret).await?; |
This file contains hidden or 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
use once_cell::sync::Lazy; | |
use reqwest::Client; | |
use serde::{Deserialize, Serialize}; | |
use std::env; | |
use tokio::fs; | |
type Error = Box<dyn std::error::Error>; | |
static CLIENT: Lazy<Client> = Lazy::new(|| Client::new()); |
This file contains hidden or 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
[dependencies] | |
reqwest = { version = "0.10", features = ["json"] } | |
tokio = { version = "0.2", features = ["macros", "fs"] } | |
serde = {version = "1.0", features = ["derive"] } | |
serde_json = "1.0" | |
once_cell = "1.4" |
This file contains hidden or 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
container-juggler generate auth |
This file contains hidden or 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
image: redis:5.0.3 | |
ports: | |
- "6379:6379" |
This file contains hidden or 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
auth-service: | |
extra_hosts: | |
- other-service:192.168.8.110 | |
- other-service-db:192.168.8.110 | |
... |
This file contains hidden or 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
templateFolderPath: ./templates/ | |
scenarios: | |
auth: | |
- redis | |
- auth-db | |
- auth-service |
This file contains hidden or 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
templateFolderPath: ./templates/ | |
scenarios: | |
auth: | |
- redis | |
- auth-db | |
- auth-service |
This file contains hidden or 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
#[derive(Clone)] | |
pub struct JobContext { | |
pub db_pool: DBPool, | |
pub redis_pool: RedisPool, | |
} | |
pub trait Job { | |
fn run(&self, ctx: &JobContext) -> JobResult; | |
fn get_interval(&self) -> Duration; | |
fn get_name(&self) -> &'static str; |