-
Notifications
You must be signed in to change notification settings - Fork 7
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
Update ENV Variables w/Values #3
Comments
Little proof of concept work thanks to @hmadison [dependencies]
redhook = "2.0"
libc = "0.2.126"
log = "0.4.17"
[lib]
name = "ssmhook"
crate_type = ["dylib"] extern crate libc;
use std::ffi::CStr;
use std::ffi::CString;
redhook::hook! {
unsafe fn getenv(name: *const libc::c_char) -> *mut libc::c_char => dangerously_mutate_getenv {
let given_pointer = redhook::real!(getenv)(name);
if given_pointer.is_null() {
return given_pointer;
}
let given_name = CStr::from_ptr(name).to_str().unwrap();
let given_value = CStr::from_ptr(given_pointer).to_str().unwrap();
println!("Got: {} / {}", given_name, given_value);
if given_name == "HELLO" {
// https://doc.rust-lang.org/std/ffi/struct.CStr.html#method.as_ptr
let result = CString::new("WORLD").unwrap();
return result.into_raw();
}
return given_pointer;
}
} |
Reference for Lambda Extension state & Runtime. |
Latest main has a working prototype. The sequence diagram is not needed because every extension inits before the runtime init. I tested this too by putting a sleep in the extension prior to SSM parameter fetching with a puts at the beginning of the runtime handler. |
metaskills
added a commit
that referenced
this issue
Jun 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thoughts on changing the way this project works by updated each matching ENV variable with the returned value. So in stead of this:
We would have this. And every runtime can simply use the environment vs constructing a fetch to localhost.
A friend shared this project as an idea on how to tap into LD_PRELOAD to update environments before the "real" lambda function/application starts. Thoughts?
https://github.com/mmanciop/opentelemetry-injector
The text was updated successfully, but these errors were encountered: