Skip to content

Commit

Permalink
working in aliyun
Browse files Browse the repository at this point in the history
  • Loading branch information
maceip committed Jun 23, 2024
1 parent 77eabb6 commit c5e3f29
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exex.manifest: exex.manifest.template
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
-Darch_libdir=$(ARCH_LIBDIR) \
-Dself_exe=$(SELF_EXE) \
$< $@
$< > $@

# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
# see the helloworld example for details on this workaround.
Expand Down
8 changes: 5 additions & 3 deletions exex.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# Rust manifest example

libos.entrypoint = "/gramine-ratls"
loader.entrypoint = "file:{{ gramine.libos }}"
loader.log_level = "{{ log_level }}"
libos.entrypoint = "/gramine-ratls"
loader.log_level = "{{ log_level }}"


loader.env.LD_LIBRARY_PATH = "/usr/local/lib:/usr{{ arch_libdir }}:{{ arch_libdir }}"

Expand All @@ -18,6 +18,8 @@ loader.argv = [
"gramine-ratls", "/tmp/crt.pem", "/tmp/key.pem", "--",
"target/release/exex",
]
loader.uid = 65534
loader.gid = 65534

fs.mounts = [
{ type = "encrypted", path = "/main.db", uri = "file:main.db", key_name = "teleportexex" },
Expand Down
11 changes: 4 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,12 @@ async fn main() {
.layer(CorsLayer::very_permissive())
.with_state(shared_state);
let config = RustlsConfig::from_pem(gram_crt_print.as_bytes().to_vec(), eph).await.unwrap();
// let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
//let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();

tokio::spawn(async move {
axum::serve(listener, app).await.unwrap();
// axum_server::bind_rustls(addr, config)
// .serve(app.into_make_service())
// .await
// .unwrap();
//axum::serve(listener, app).await.unwrap();
axum_server::bind_rustls(addr, config).serve(app.into_make_service()).await.unwrap();
});
subscribe_to_nft_events(db, ws_rpc_url).await.unwrap();
}
19 changes: 6 additions & 13 deletions src/twitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,14 @@ mod tests {
async fn like_tweet_test() {
env_logger::init();
dotenv::dotenv().ok();
let access_token = std::env::var("TEST_ACCESS_TOKEN")
.expect("TEST_ACCESS_TOKEN not set")
.to_string();
let access_secret = std::env::var("TEST_ACCESS_SECRET")
.expect("TEST_ACCESS_SECRET not set")
.to_string();
let access_token =
std::env::var("TEST_ACCESS_TOKEN").expect("TEST_ACCESS_TOKEN not set").to_string();
let access_secret =
std::env::var("TEST_ACCESS_SECRET").expect("TEST_ACCESS_SECRET not set").to_string();
let x_info = get_user_x_info(access_token.clone(), access_secret.clone()).await;
let x_id = x_info.id;
let _ = like_tweet(
access_token,
access_secret,
x_id,
"1803455775911694374".to_string(),
)
.await;
let _ =
like_tweet(access_token, access_secret, x_id, "1803455775911694374".to_string()).await;
}

#[tokio::test]
Expand Down

0 comments on commit c5e3f29

Please sign in to comment.