Fixes #205
Adds noBundledConfig
option to Webpack, esbuild, vite and rollup plugins - useful if you always use @app-config/inject
.
Some bug fixes and improvements for Rollup, ESBuild and Vite plugins.
Adds support for injecting currentEnvironment
from @app-config/inject
.
Adds support for reading APP_CONFIG_SECRETS_KEY_FILE
.
Adds plugin for esbuild!
Ensures that window._appConfig
is always written in webpack and rollup loaders.
Fixes bug in $extends directive when using specific environments.
Adds Electron support!
Supports named export in react native #167.
Ensures that NotFoundErrors aren't ignored when transitive in optional files (#160).
Adds plugins for vite and rollup!
Adds ac
as an npx alias for app-config
.
Adds support for calling currentEnvironment
when using the Webpack plugin.
Adds env
option on $extends
and $override
directives.
Adds some early deprecation warnings in preparation for version 3. See here.
Allows default extensions to be used twice without conflicts.
Adds $parseBool
, $parseFloat
and $parseInt
directives.
Adds allowMissing
option on $envVar
that's a shorthand for allowNull
+ fallback: null
.
Creates new calling interface for currentEnvironment
and FlexibleFileSource
.
Adds $hidden
directive mainly for shared properties.
Adds bash completions support with app-config completions
.
Adds none
option for the $env
directive, that acts like "default", but is used
only when no environment is defined.
Adds option aliases for $substitute
that aren't prefixed with $
.
Adds $envVar
parsing directive, similar to $substitute
but more ergonomic.
Adds support for Webpack 5, remaining compatible with Webpack 4.
Doesn't strip newlines in @app-config/inject and @app-config/cli when reading from stdin.
Adds --include-no-environment
for app-config validate
CLI. Fails when no config is found.
Fixes Webpack bug when using $extends
to a file that's not a standard app-config filename.
Supports providing a module name as "augmentModule" option in TypeScript definition generation.
Uses single quotes when generating enums in TypeScript, which is more common in prettier et al.
Adds @app-config/js
package for evaluating JS modules.
Adds noGlobal
option for webpack config, enabling "static" configuration.
Also adds intercept
option for webpack plugin, to enable non-standard "aliases" for configuration.
Makes it easy to have a part of app config "static" and a part "dynamic".
Adds binary releases through pkg
.
Resolves relative files (runs relative to app-config file) in @app-config/exec
.
Adds resolveFilepath
export from node package to help do this in extensions.
Adds $try
and $if
"macros" for rudimentary control flow.
Adds $parseInt
, $parseFloat
and $parseBool
options for $substitute
to parse environment variables.
Adds @app-config/exec
parsing extension package for dynamically running shell commands.
Adjusts inter-package dependencies to use caret version ranges, making upgrades easier.
Modularizes code entirely, separating parsing extensions, encryption, etc.
Renames the main module to @app-config/main
, aliased by @lcdev/app-config
.
Adds tag
option for $git
directive.
Adds $name
and $fallback
options for $substitute
.
Removes v1 support from webpack plugin.
Returns an unsubscribe callback from mockConfig
.
Adds support for meta file properties environmentAliases
and environmentSourceNames
.
(PR).
Support for Cypress through @app-config/cypress.
Adds mockConfig
function that accepts an override for configuration internally.
Adds @types/json-schema
explicitly as a dependency, so that installs are "one step".
Added a CI test to ensure this doesn't regress.
Fixes schema validation of "secret" values whe an array is marked as secret: true
.
This should only check that all items are secret, not that the array itself is secret.
This new major version is effectively a rewrite, with some powerful constructs being added internally. Much of this is does not change the external semantics of the package, but internally it makes a huge difference.
The selling point for this upgrade is secret encryption. This means that a built-in solution for storing your secrets in a safe, encrypted form.
Previous to v2, secrets were a complimentary feature. This meant it was left to the user how and where secret values were stored.
In general, it's nice to store configuration in version control if possible. This is, of course, impractical for values that should never be public. Having these secrets in plaintext is just asking for trouble.
Solutions have come out to do this - git-secret, git-crypt and blackbox to name a few. We have built a similar solution, but highly integrated. At Launchcode, we tried these solutions, but felt that they were clunky to use for users who weren't very familiar with GPG.
So, we set course on designing an interface that combined the security of these tools with the ergonomics that developers expect. There were many dead ends, actually. It became increasing obvious that such a feature could not be easily added to app-config without a fairly major change in architecture.
- The
{function}Sync
function interfaces have been removed. Almost all functions are async-only. - We no longer look for
app-config.{ext}
files - only.app-config.{ext}
is loaded by default. - The default export of the function is not available prior to
loadConfig
being called. Essentially, you'll need to add a call toloadConfig
in your program's entrypoint. Note that TypeScript can't help you here, since theconfig
object has a non-optional type. Also note that webpack projects do not need to make any changes, since the async portion is done at build time.
import config, { loadConfig } from '@lcdev/app-config';
async function main() {
await loadConfig();
// after loadConfig is resolved (not just called!), `config` is accessible
console.log(config);
}
- The Node.js API has quite a few breaking changes. These should all be apparent in the TypeScript types. Unfortunately, this has the effect of making compatible tools difficult (eg. webpack plugin). We intend to ship a compatibility layer in v1, so that tools can rely on the v2 API without worry.
- The environment variable name algorithm (used to flatten your config into
APP_CONFIG_FOO_BAR
) is a bit different. The obvious change is with numbers in variable names -address1
now gets transformed toADDRESS_1
instead ofADDRESS1
. - Environment variable substitution (eg.
port: '${PORT:-3000}'
) does not happen automatically anymore. Use the$substitute
directive instead. - The config sub-object code generation has been removed. (eg. generating a JSON file in meta properties) To our knowledge, nobody used this.
- Schema loading no longer supports the
app-config
special property, and does not use$extends
directive by default - use$ref
s instead. - There are some very subtle differences in the merging algorithm used when loading files (relevant if you have secret files that override non-secret files). Differences here are likely to be bugs though!
- The CLI interface is subtly different, but almost entirely compatible.
- The
app-config init
subcommand was removed. We don't want to build a scaffolding tool. - Some internal packages have been upgraded. Notably, we use an internal package of quicktype which doesn't make stability guarantees.
- Error messages have been overhauled. Relying on them is brittle though.
- Secret values can now be encrypted and placed in
.app-config.{ext}
files! Check out the encryption guide. - Instead of using a root-level
app-config
value, you can now use$extends
and$override
anywhere in the tree of configuration. Check out the parsing extensions guide. Note that a compatibility layer is in place forapp-config
values, which may be removed in the future. - A simple logger has been added internally. The
setLogLevel
function is exported. You can setAPP_CONFIG_LOG_LEVEL
as well. - You can now define your own parsing extensions. This is an advanced feature, but available if you want to do powerful value transformations.
- Primitives are available for creating your own config loading strategy. You can mix-and-match parsing, file sources, environment variables, etc. Check out the Node.js API guide for more.