This commit is contained in:
thosakwe 2016-09-19 16:31:32 -04:00
parent 3317624c49
commit 20de6cccf5
2 changed files with 18 additions and 3 deletions

View file

@ -1,5 +1,5 @@
# Angel Configuration # Angel Configuration
YAML configuration loader for Angel. Isomorphic YAML configuration loader for Angel.
# About # About
Any web app needs different configuration for development and production. This plugin will search Any web app needs different configuration for development and production. This plugin will search
@ -18,6 +18,8 @@ dependencies:
# Usage # Usage
**Server-side**
```dart ```dart
import 'dart:io'; import 'dart:io';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
@ -25,10 +27,23 @@ import 'package:angel_configuration/angel_configuration.dart';
main() async { main() async {
Angel angel = new Angel(); Angel angel = new Angel();
angel.configure(loadConfigurationFile()); // It's that easy angel.configure(loadConfigurationFile()); // It's that easy!
} }
``` ```
`loadConfigurationFile` also accepts a `sourceDirectory` or `overrideEnvironmentName` parameter. `loadConfigurationFile` also accepts a `sourceDirectory` or `overrideEnvironmentName` parameter.
The former will allow you to search in a directory other than `config`, and the latter lets you The former will allow you to search in a directory other than `config`, and the latter lets you
override `$ANGEL_ENV` by specifying a specific configuration name to look for (i.e. 'production'). override `$ANGEL_ENV` by specifying a specific configuration name to look for (i.e. 'production').
**In the Browser**
You can easily load configuration values within your client-side app,
and they will be automatically replaced by a Barback transformer.
```dart
import 'package:angel_configuration/browser.dart';
main() async {
print(config("some_key.other.nested_key"));
}
```

View file

@ -1,5 +1,5 @@
name: angel_configuration name: angel_configuration
description: YAML configuration loader for Angel. description: Isomorphic YAML configuration loader for Angel.
version: 1.0.1+1 version: 1.0.1+1
author: thosakwe <thosakwe@gmail.com> author: thosakwe <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_configuration homepage: https://github.com/angel-dart/angel_configuration