Commit graph

12 commits

Author SHA1 Message Date
Matt Ellis 5eb78af779 Do not lazy initialize config or settings
The pulumi runtime used to lazily load and parse both config and
settings data set by the language host. The initial reason for this
design was that we wanted the runtime to be usable in a normal node
environment, but we have moved away from supporting that.

In addition, while we claimed we loaded these value "lazily", we
actually forced their loading quite eagerly when we started
up. However, when capturing config (or settings, as we now do), we
would capture all the logic about loading these values from the
environment.

Even worse, in the case where you had two copies of @pulumi/pulumi
loaded, it would be possible to capture a config object which was not
initialized and then at runtime the initialization logic would try to
read PULUMI_CONFIG from the process environment and fail.

So we adopt a new model where configuration and settings are parsed as
we load their containing modules. In addition, to support SxS
scinerios, we continue to use `process.env` as a way to control both
configuration and settings. This means that `run.ts` must now ensure
that these values are present in the environment before either the
config or runtime modules have been loaded.
2018-08-06 15:53:38 -07:00
CyrusNajmabadi d19942f2b0
Go back to capturing *non-user* modules by 'require' reference. (#1655) 2018-07-31 11:37:46 -04:00
joeduffy 5967259795 Add license headers 2018-05-22 15:02:47 -07:00
Joe Duffy 150f57168a
Fix SxS config (#1175)
We weren't properly lazily loading everywhere we need to.
2018-04-13 11:26:01 -07:00
Joe Duffy 28033c22bc
Allow multiple Pulumi SDKs side-by-side (#1132)
Prior to this change, if you ended up with multiple Pulumi SDK
packages loaded side-by-side, we would fail in obscure ways.  The
reason for this was that we initialize and store important state
in static variables.  In the case that you load the same library
twice, however, you end up with separate copies of said statics,
which means we would be missing engine RPC addresses and so on.

This change adds the ability to recover from this situation by
mirroring the initialized state in process-wide environment
variables.  By doing this, we can safely recover simply by reading
them back when we detect that they are missing.  I think we can
eventually go even further here, and eliminate the entry point
launcher shim altogether by simply having the engine launch the
Node program with the right environment variables.  This would
be a nice simplification to the system (fewer moving pieces).

There is still a risk that the separate copy is incompatible.
Presumably the reason for loading multiple copies is that the
NPM/Yarn version solver couldn't resolve to a shared version.
This may yield obscure failure modes should RPC interfaces change.
Figuring out what to do here is part of pulumi/pulumi#957.

This fixes pulumi/pulumi#777 and pulumi/pulumi#1017.
2018-04-07 08:02:59 -07:00
Pat Gavlin a23b10a9bf
Update the copyright end date to 2018. (#1068)
Just what it says on the tin.
2018-03-21 12:43:21 -07:00
Matt Ellis 1515889a40 Remove the need for the :config: part of a config bag
We now unify new Config("package") and new Config("package:config"),
printing a warning when the new Config("package:config") form is
used and pointing consumers towards just new Config("package")

I've updated our examples to use the newer syntax, but I've added a
test ot the langhost to ensure both forms work.

Fixes #923
2018-03-08 10:52:25 -08:00
Joe Duffy 444ebdd1b5
Improve failure messages (#932)
This improves the failure messages in two circumstances:

1) If the resource monitor RPC connection is missing.  This can happen
   two ways: either you run a Pulumi program using vanilla Node.js, instead
   of the CLI, or you've accidentally loaded the Pulumi SDK more than once.

2) Failure to load the custom Pulumi SDK Node.js extension.  This is a new
   addition and would happen if you tried running a Pulumi program using a
   vanilla Node.js, rather than using the Pulumi CLI.
2018-02-14 09:55:02 -08:00
CyrusNajmabadi d929c169de Enable tslinting of the nodejs sdk. (#433) 2017-10-18 15:03:56 -07:00
joeduffy 65184ec6bd Enable PULUMI_CONFIG envvars, use them
This change adds environment variable fallbacks for configuration
variables, such that you can either set them explicitly, as a specific
variable PULUMI_CONFIG_<K>, or an entire JSON serialized bag via
PULUMI_CONFIG.

This is convenient when simply invoking programs at the command line,
via node, e.g.

    PULUMI_CONFIG_AWS_CONFIG_REGION=us-west-2 node bin/index.js

Our language host also now uses this to communicate config when invoking
a Run RPC, rather than at the command line.  This fixes pulumi/pulumi#336.
2017-10-11 18:41:52 -07:00
Luke Hoban c5558e2778 Convert sdk documentation to TypeDoc/JsDoc 2017-09-21 18:15:29 -07:00
joeduffy d8635fd4f3 Move modules to package root
The organization of packages underneath lib/ breaks the easy consumption
of submodules, a la

    import {FileAsset} from "@pulumi/pulumi-fabric/asset";

We will go back to having everything hanging off the module root directory.
2017-09-04 11:35:21 -07:00
Renamed from sdk/nodejs/lib/runtime/config.ts (Browse further)