Skip to content

Instantly share code, notes, and snippets.

@smothiki
Last active May 12, 2016 23:25
Show Gist options
  • Save smothiki/cf2b57c4881ecbd7dd351f6ecca7e06f to your computer and use it in GitHub Desktop.
Save smothiki/cf2b57c4881ecbd7dd351f6ecca7e06f to your computer and use it in GitHub Desktop.
generate params
package main
import (
"fmt"
"os"
"strings"
"text/template"
)
type generate struct {
}
type storage struct {
RegBucket string
DataBucket string
BuildBucket string
StorageType string
Region string
Accesskey string
Secretkey string
Accountname string
Accountkey string
KeyJSON string
}
func checkError(err error) {
if err != nil {
fmt.Println("Fatal error ", err.Error())
os.Exit(1)
}
}
func replace(key string) string {
return strings.Replace(key, """, "\"", -1)
}
func main() {
storageObj := storage{
RegBucket: os.Getenv("regBucket"),
DataBucket: os.Getenv("dataBucket"),
BuildBucket: os.Getenv("buildBucket"),
StorageType: os.Getenv("storagebackend"),
Region: os.Getenv("region"),
Accesskey: os.Getenv("accesskey"),
Secretkey: os.Getenv("secretkey"),
Accountname: os.Getenv("accountname"),
KeyJSON: os.Getenv("keyjson"),
}
fmt.Println(storageObj)
// funcs := template.FuncMap{"KeyJSON": html.UnescapeString}
t, err := template.ParseFiles("params.toml")
checkError(err)
output, err := os.Create("generate_params.toml")
err = t.Execute(output, storageObj)
checkError(err)
}
#helm:generate $HELM_GENERATE_DIR/tpl/minio.sh
#
# This is the main configuration file for Deis object storage. The values in
# this file are passed into the appropriate services so that they can configure
# themselves for persisting data in object storage.
#
# In general, all object storage credentials must be able to read and write to
# the container or bucket they are configured to use.
#
# When you change values in this file, make sure to re-run `helmc generate`
# on this chart.
# Set the storage backend
#
# Valid values are:
# - s3: Store persistent data in AWS S3 (configure in S3 section)
# - azure: Store persistent data in Azure's object storage
# - gcs: Store persistent data in Google Cloud Storage
# - minio: Store persistent data on in-cluster Minio server
storage = "{{.StorageType}}"
[minio]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[s3]
accesskey = "{{.Accesskey}}"
secretkey = "{{.Secretkey}}"
# Any S3 region
region = "{{.Region}}"
# Your buckets.
registry_bucket = "{{.RegBucket}}"
database_bucket = "{{.DataBucket}}"
builder_bucket = "{{.BuildBucket}}"
[azure]
accountname = "{{.Accountname}}"
accountkey = "{{.Accountkey}}"
registry_container = "{{.RegBucket}}"
database_container = "{{.DataBucket}}"
builder_container = "{{.BuildBucket}}"
[gcs]
# key_json is expanded into a JSON file on the remote server. It must be
# well-formatted JSON data.
key_json = '''{{.KeyJSON}}'''
registry_bucket = "{{.RegBucket}}"
database_bucket = "{{.DataBucket}}"
builder_bucket = "{{.BuildBucket}}"
[builder]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[slugbuilder]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[dockerbuilder]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[controller]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[slugrunner]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[database]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[registry]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[workflowManager]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
versionsApiURL = "https://versions-staging.deis.com"
[logger]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[router]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[fluentd]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[grafana]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[influxdb]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[telegraf]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
[stdoutmetrics]
org = "deisci"
pullPolicy = "Always"
dockerTag = "canary"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment