Skip to content

Commit

Permalink
[push] Move to json5 for config.
Browse files Browse the repository at this point in the history
Bug: skia:6933
Change-Id: I0f51ef1b6e47d1a411af5947a2b460bea2adeab7
Reviewed-on: https://skia-review.googlesource.com/35440
Reviewed-by: Ravi Mistry <[email protected]>
Commit-Queue: Joe Gregorio <[email protected]>
  • Loading branch information
jcgregorio authored and Skia Commit-Bot committed Aug 16, 2017
1 parent 6338abc commit 9cb7312
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 341 deletions.
13 changes: 9 additions & 4 deletions go/packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"sync"
"time"

"github.com/BurntSushi/toml"
"github.com/flynn/json5"
iexec "go.skia.org/infra/go/exec"
"go.skia.org/infra/go/gcs"
"go.skia.org/infra/go/sklog"
Expand Down Expand Up @@ -499,15 +499,20 @@ type ServerConfig struct {
//
// It is a list of servers (by GCE domain name) and the list
// of apps that are allowed to be installed on them. It is
// loaded from infra/push/skiapush.conf in toml format.
// loaded from infra/push/skiapush.json5 in JSON5 format.
type PackageConfig struct {
Servers map[string]ServerConfig
}

func LoadPackageConfig(filename string) (PackageConfig, error) {
var config PackageConfig
// Read toml config file.
if _, err := toml.DecodeFile(filename, &config); err != nil {
f, err := os.Open(filename)
if err != nil {
return config, fmt.Errorf("Failed to open config file: %s", err)
}
defer util.Close(f)
dec := json5.NewDecoder(f)
if err := dec.Decode(&config); err != nil {
return config, fmt.Errorf("Failed to decode config file: %s", err)
}
return config, nil
Expand Down
2 changes: 1 addition & 1 deletion push/build_pushd_release
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ copy_release_files()
INSTALL="sudo install -D --verbose --backup=none --group=root --owner=root"
${INSTALL} --mode=644 -T ./sys/${APPNAME}.service ${ROOT}/etc/systemd/system/${APPNAME}.service
${INSTALL} --mode=755 -T ${GOPATH}/bin/push ${ROOT}/usr/local/bin/${APPNAME}
${INSTALL} --mode=644 -T ./skiapush.conf ${ROOT}/etc/${APPNAME}/skiapush.conf
${INSTALL} --mode=644 -T ./skiapush.json5 ${ROOT}/etc/${APPNAME}/skiapush.json5
${INSTALL} --mode=644 -T ./res/vul/elements.html ${ROOT}/usr/local/share/${APPNAME}/res/vul/elements.html
${INSTALL} --mode=644 -T ./res/js/core.js ${ROOT}/usr/local/share/${APPNAME}/res/js/core.js
${INSTALL} --mode=644 -T ./templates/header.html ${ROOT}/usr/local/share/${APPNAME}/templates/header.html
Expand Down
2 changes: 1 addition & 1 deletion push/go/push/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const (
// flags
var (
bucketName = flag.String("bucket_name", "skia-push", "The name of the Google Storage bucket that contains push packages and info.")
configFilename = flag.String("config_filename", "skiapush.conf", "Config filename.")
configFilename = flag.String("config_filename", "skiapush.json5", "Config filename.")
local = flag.Bool("local", false, "Running locally if true. As opposed to in production.")
port = flag.String("port", ":8000", "HTTP service address (e.g., ':8000')")
project = flag.String("project", "google.com:skia-buildbots", "The Google Compute Engine project.")
Expand Down
2 changes: 1 addition & 1 deletion push/go/pushcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
rollback = flag.Bool("rollback", false, "If true roll back to the next most recent package, otherwise use the most recently pushed package.")
force = flag.Bool("force", false, "If true then install the package even if it hasn't previously been installed on the given server.")
dryrun = flag.Bool("dryrun", false, "If true don't actually push, but just log what actions would be taken.")
configFilename = flag.String("config_filename", "skiapush.conf", "Config filename used by Push.")
configFilename = flag.String("config_filename", "skiapush.json5", "Config filename used by Push.")
)

func init() {
Expand Down
333 changes: 0 additions & 333 deletions push/skiapush.conf

This file was deleted.

Loading

0 comments on commit 9cb7312

Please sign in to comment.