angel_configuration 2.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 84

configuration

Pub build status

Automatic YAML configuration loader for Angel.

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

In pubspec.yaml:

dependencies:
    angel_configuration: ^1.0.0

Usage

Example Configuration

# Define normal YAML objects
some_key: foo
this_is_a_map:
  a_string: "string"
  another_string: "string"
  

You can also load configuration from the environment:

# Loaded from the environment
system_path: $PATH

If a .env file is present in your configuration directory, then it will be loaded before applying YAML configuration.

Server-side 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 internally, so existing configurations can be deeply merged.

Example:

# default.yaml
foo:
  bar: baz
  quux: hello
  
# production.yaml
foo:
  quux: goodbye
  yellow: submarine
  
# Propagates to:
foo:
  bar: baz
  quux: goodbye
  yellow: submarine

2.0.0

  • Use Angel 2.

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)

  • Use package:file.

1.0.5

  • Now using package:merge_map to merge configurations. Resolves #5.
  • You can now specify a custom envPath.

example/main.dart

import 'package:angel_configuration/angel_configuration.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:file/local.dart';

main() async {
  var app = new Angel();
  var fs = const LocalFileSystem();
  await app.configure(configuration(fs));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  angel_configuration: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:angel_configuration/angel_configuration.dart';
  
Version Uploaded Documentation Archive
2.0.0 Aug 21, 2018 Go to the documentation of angel_configuration 2.0.0 Download angel_configuration 2.0.0 archive
1.2.0 Jul 14, 2018 Go to the documentation of angel_configuration 1.2.0 Download angel_configuration 1.2.0 archive
1.1.0 Dec 7, 2017 Go to the documentation of angel_configuration 1.1.0 Download angel_configuration 1.1.0 archive
1.0.5 Aug 16, 2017 Go to the documentation of angel_configuration 1.0.5 Download angel_configuration 1.0.5 archive
1.0.4 Jun 14, 2017 Go to the documentation of angel_configuration 1.0.4 Download angel_configuration 1.0.4 archive
1.0.3 Mar 8, 2017 Go to the documentation of angel_configuration 1.0.3 Download angel_configuration 1.0.3 archive
1.0.2 Mar 8, 2017 Go to the documentation of angel_configuration 1.0.2 Download angel_configuration 1.0.2 archive
1.0.1+8 Nov 28, 2016 Go to the documentation of angel_configuration 1.0.1+8 Download angel_configuration 1.0.1+8 archive
1.0.1+7 Nov 23, 2016 Go to the documentation of angel_configuration 1.0.1+7 Download angel_configuration 1.0.1+7 archive
1.0.1+6 Nov 23, 2016 Go to the documentation of angel_configuration 1.0.1+6 Download angel_configuration 1.0.1+6 archive

All 20 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
76
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, other

Primary library: package:angel_configuration/angel_configuration.dart with components: io.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
angel_framework ^2.0.0-alpha 2.0.0-alpha.14
dotenv ^1.0.0 1.0.0
file ^5.0.0 5.0.6
merge_map ^1.0.0 1.0.1
yaml ^2.0.0 2.1.15
Transitive dependencies
angel_container 1.0.0
angel_http_exception 1.0.0+3
angel_model 1.0.0+1
angel_route 3.0.0
args 1.5.1
body_parser 1.1.1
charcode 1.1.2
code_buffer 1.0.1
collection 1.14.11
combinator 1.0.0+3
convert 2.0.2
crypto 2.0.6
dart2_constant 1.0.2+dart2
http2 0.1.9
http_parser 3.1.3
http_server 0.9.8+1
intl 0.15.7
logging 0.11.3+2
matcher 0.12.4
meta 1.1.6
mime 0.9.6+2
mock_request 1.0.4
path 1.6.2
quiver 2.0.1
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.4
tuple 1.0.2
typed_data 1.1.6
uuid 1.0.3
Dev dependencies
test ^1.0.0