Updated configuration

This commit is contained in:
thomashii 2021-07-08 13:23:02 +08:00
parent c4f26ad4ca
commit 5a014bf1d0
8 changed files with 48 additions and 27 deletions

View file

@ -1,6 +1,6 @@
# Angel3 Anthentication
[![version](https://img.shields.io/badge/pub-v4.0.4-brightgreen)](https://pub.dartlang.org/packages/angel3_auth)
[![version](https://img.shields.io/badge/pub-v4.0.4-brightgreen)](https://pub.dev/packages/angel3_auth)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)

View file

@ -1,12 +1,12 @@
# HTTP Caching for Angel3
[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_cache)
[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dev/packages/angel3_cache)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/cache/LICENSE)
A service that provides HTTP caching to the response data for [Angel3](https://github.com/dukefirehawk/angel).
A service that provides HTTP caching to the response data for [Angel3 framework](https://pub.dev/packages/angel3).
## `CacheService`

View file

@ -1,29 +1,45 @@
# 4.0.0
# Change Log
## 4.0.1
* Updated README
* Fixed unit tests
* All 8 unit test passed
## 4.0.0
* Migrated to support Dart SDK 2.12.x NNBD
# 3.0.0
## 3.0.0
* Migrated to work with Dart SDK 2.12.x Non NNBD
# 2.2.0
## 2.2.0
* Allow including one configuration within another.
* Badly-formatted `.env` files will no longer issue a warning,
but instead throw an exception.
# 2.1.0
## 2.1.0
* Add `loadStandaloneConfiguration`.
# 2.0.0
## 2.0.0
* Use Angel 2.
# 1.2.0-rc.0
## 1.2.0-rc.0
* Removed the `Configuration` class.
* Removed the `ConfigurationTransformer` class.
* Use `Map` casting to prevent runtime cast errors.
# 1.1.0 (Retroactive changelog)
## 1.1.0 (Retroactive changelog)
* Use `package:file`.
# 1.0.5
## 1.0.5
* Now using `package:merge_map` to merge configurations. Resolves
[#5](https://github.com/angel-dart/configuration/issues/5).
* You can now specify a custom `envPath`.

View file

@ -1,21 +1,23 @@
# angel3_configuration
[![version](https://img.shields.io/badge/pub-v4.0.0-brightgreen)](https://pub.dartlang.org/packages/angel3_configuration)
# Angel3 Configuration Loader
[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dev/packages/angel3_configuration)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/configuration/LICENSE)
Automatic YAML configuration loader for [Angel3 framework](https://pub.dev/packages/angel3)
Automatic YAML configuration loader for Angel.
## About
# About
Any web app needs different configuration for development and production. This plugin will search
for a `config/default.yaml` file. If it is found, configuration from it is loaded into `app.configuration`.
Then, it will look for a `config/$ANGEL_ENV` file. (i.e. config/development.yaml). If this found, all of its
configuration be loaded, and will override anything loaded from the `default.yaml` file. This allows for your
app to work under different conditions without you re-coding anything. :)
# Installation
## Installation
In `pubspec.yaml`:
```yaml
@ -23,9 +25,10 @@ dependencies:
angel3_configuration: ^3.0.0
```
# Usage
## Usage
Example Configuration
**Example Configuration**
```yaml
# Define normal YAML objects
some_key: foo
@ -36,6 +39,7 @@ this_is_a_map:
```
You can also load configuration from the environment:
```yaml
# Loaded from the environment
system_path: $PATH
@ -45,6 +49,7 @@ If a `.env` file is present in your configuration directory (i.e. `config/.env`)
applying YAML configuration.
You can also include values from one file into another:
```yaml
_include:
- "./include-prod.yaml"
@ -53,15 +58,13 @@ _include: "just-one-file.yaml"
```
**Server-side**
Call `configuration()`. The loaded configuration will be available in your application's
`configuration` map.
Call `configuration()`. The loaded configuration will be available in your application's `configuration` map.
`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
override `$ANGEL_ENV` by specifying a specific configuration name to look for (i.e. `production`).
This package uses
[`package:merge_map`](https://github.com/thosakwe/merge_map)
This package uses [`package:angel3_merge_map`](https://pub.dev/packages/angel3_merge_map)
internally, so existing configurations can be deeply merged.
Example:

View file

@ -1,7 +1,8 @@
name: angel3_configuration
description: Automatic YAML application configuration loader for Angel, with .env support.
version: 4.0.0
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/configuration
version: 4.0.1
homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/configuration
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:

View file

@ -0,0 +1 @@
included: true

View file

@ -1,5 +1,5 @@
_include:
- "./include.yaml"
- "./custom.yaml"
hello: world
foo:
version: bar

View file

@ -1,6 +1,6 @@
# Angel3 Framework
[![version](https://img.shields.io/badge/pub-v4.1.1-brightgreen)](https://pub.dartlang.org/packages/angel3_framework)
[![version](https://img.shields.io/badge/pub-v4.1.1-brightgreen)](https://pub.dev/packages/angel3_framework)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)