-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wrapper binary for cloud foundry integration.
- Loading branch information
Showing
5 changed files
with
75 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -45,3 +45,6 @@ | |
/tmp | ||
|
||
/src/api-umbrella/example-website/.hugo_build.lock | ||
|
||
# Added by cargo | ||
/target |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "api-umbrella-postgres" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
[[bin]] | ||
name = "envoy-config-wrapper" | ||
path = "src/api-umbrella/bin/envoy-config-wrapper.rs" | ||
|
||
[profile.release] | ||
panic = "abort" | ||
strip = true |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::env; | ||
use std::fs; | ||
use std::os::unix::process::CommandExt; | ||
use std::process::Command; | ||
|
||
// A minimal binary that writes the Envoy config file based on YAML in an | ||
// environment variable, and then replaces the process with the real envoy | ||
// process (passing all arguments along). | ||
// | ||
// The driver of this is to have a statically compiled binary that will work in | ||
// our "distroless" envoy egress image in a way that makes it easier to | ||
// integrate our configuration from environment variables in Cloud Foundry | ||
// (since it can't mount files into the container). | ||
fn main() { | ||
let config_yaml = env::var("ENVOY_CONFIG_YAML"); | ||
if config_yaml.is_ok() { | ||
fs::write("/etc/envoy/envoy.yaml", config_yaml.unwrap()) | ||
.expect("Error writing '/etc/envoy/envoy.yaml' file"); | ||
} | ||
|
||
let args: Vec<_> = env::args_os().skip(1).collect(); | ||
let err = Command::new("/usr/local/bin/envoy").args(&args).exec(); | ||
println!("Error: {}", err); | ||
} |