Last active
February 2, 2017 19:48
-
-
Save uncompiled/a86033e07d341b30864032110a2fb473 to your computer and use it in GitHub Desktop.
R script for querying application configurations in nile.yml
This file contains hidden or 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
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