mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Add Env to cli example
This commit is contained in:
parent
21f3d4b8bc
commit
7d1376b273
5 changed files with 137 additions and 21 deletions
|
@ -377,3 +377,17 @@ pub extern "C" fn roc_fx_sendRequest(roc_request: &glue::Request) -> glue::Respo
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn roc_fx_httpGetUtf8(url: &RocStr) -> RocStr {
|
||||
let body: String = ureq::get(url).call().unwrap().into_string().unwrap();
|
||||
|
||||
RocStr::from(body.as_str())
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn roc_fx_envVarUtf8(key: &RocStr) -> RocStr {
|
||||
let val: String = dbg!(std::env::var(dbg!(key.as_str()))).unwrap();
|
||||
|
||||
RocStr::from(val.as_str())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue