2017-06-26 23:46:34 +02:00
|
|
|
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
2016-11-16 17:19:26 +01:00
|
|
|
|
2016-11-16 18:29:44 +01:00
|
|
|
package encoding
|
2016-11-16 17:19:26 +01:00
|
|
|
|
|
|
|
import (
|
2017-08-02 18:25:22 +02:00
|
|
|
"github.com/pulumi/pulumi-fabric/pkg/util/contract"
|
2016-11-16 17:19:26 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2017-05-18 20:38:28 +02:00
|
|
|
// Ensure a marshaler is available for every possible Lumifile extension
|
2016-11-16 17:19:26 +01:00
|
|
|
Marshalers = make(map[string]Marshaler)
|
Support Workspaces
This change adds support for Workspaces, a convenient way of sharing settings
among many Stacks, like default cluster targets, configuration settings, and the
like, which are not meant to be distributed as part of the Stack itself.
The following things are included in this checkin:
* At workspace initialization time, detect and parse the .mu/workspace.yaml
file. This is pretty rudimentary right now and contains just the default
cluster targets. The results are stored in a new ast.Workspace type.
* Rename "target" to "cluster". This impacts many things, including ast.Target
being changed to ast.Cluster, and all related fields, the command line --target
being changed to --cluster, various internal helper functions, and so on. This
helps to reinforce the desired mental model.
* Eliminate the ast.Metadata type. Instead, the metadata moves directly onto
the Stack. This reflects the decision to make Stacks "the thing" that is
distributed, versioned, and is the granularity of dependency.
* During cluster targeting, add the workspace settings into the probing logic.
We still search in the same order: CLI > Stack > Workspace.
2016-11-22 19:41:07 +01:00
|
|
|
for _, ext := range Exts {
|
2016-11-16 17:19:26 +01:00
|
|
|
switch ext {
|
|
|
|
case ".json":
|
2016-11-25 21:58:29 +01:00
|
|
|
Marshalers[ext] = JSON
|
2016-11-16 17:19:26 +01:00
|
|
|
case ".yml":
|
|
|
|
fallthrough
|
|
|
|
case ".yaml":
|
2016-11-25 21:58:29 +01:00
|
|
|
Marshalers[ext] = YAML
|
2016-11-16 17:19:26 +01:00
|
|
|
default:
|
2017-05-18 20:38:28 +02:00
|
|
|
contract.Failf("No Marshaler available for LumifileExt %v", ext)
|
2016-11-16 17:19:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|