Update README
This commit is contained in:
parent
21c207fe70
commit
d9391c05fe
1 changed files with 1 additions and 28 deletions
29
README.md
29
README.md
|
@ -43,34 +43,7 @@ applying YAML configuration.
|
||||||
|
|
||||||
**Server-side**
|
**Server-side**
|
||||||
Call `configuration()`. The loaded configuration will be available in your application's
|
Call `configuration()`. The loaded configuration will be available in your application's
|
||||||
`configuration` map, which means you can access them like normal instance members.
|
`configuration` map.
|
||||||
|
|
||||||
```dart
|
|
||||||
main() {
|
|
||||||
print(app.foo == app.configuration['foo']); // true
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
An instance of `Configuration` will also be injected to your application, and it works
|
|
||||||
the same way:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
import 'dart:io';
|
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
|
||||||
import 'package:angel_configuration/angel_configuration.dart';
|
|
||||||
import 'package:file/local.dart';
|
|
||||||
|
|
||||||
main() async {
|
|
||||||
var app = new Angel();
|
|
||||||
var fileSystem = const LocalFileSystem();
|
|
||||||
|
|
||||||
await app.configure(configuration(fileSystem)); // It's that easy!
|
|
||||||
|
|
||||||
app.get('/foo', (Configuration config) {
|
|
||||||
return config.some_key;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`configuration` also accepts a `sourceDirectory` or `overrideEnvironmentName` parameter.
|
`configuration` 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
|
||||||
|
|
Loading…
Reference in a new issue