Skip to content

Instantly share code, notes, and snippets.

@uncompiled
Last active February 2, 2017 19:48
Show Gist options
  • Save uncompiled/a86033e07d341b30864032110a2fb473 to your computer and use it in GitHub Desktop.
Save uncompiled/a86033e07d341b30864032110a2fb473 to your computer and use it in GitHub Desktop.
R script for querying application configurations in nile.yml
library(yaml)
# setwd("~/directory/to/nile/configs")
# Create data frame with desired input fields
yamlFile <- yaml.load_file("nile.yml")
# Load configurations into a dataframe
df <- data.frame(
lapply(
yamlFile$environments,
function(env) { c(env$name, env$namespace, env$override$pagebuilder$ports) }
)
)
# Transpose the data frame and apply colnames
envs <- data.frame(t(df))
rownames(envs) <- NULL
colnames(envs) <- c("name", "namespace", "ports")
# Sort the environments by namespace and ports
environments <- envs[ order(envs$namespace, envs$ports), c(1, 2, 3) ]
# Remove unnecessary data from workspace
rm(yamlFile, df, envs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment