confy to load YAML based configuration file.
Features
- Load global configuration file
.confy.yamlor.confy.yml. - Load specific configuration file conditionally based.
.confy.prod.ymlor.confy.dev.yml.
Usage
- Add your global configuration
.confy.ymlin the same dart application directory. - Optionally add another envy file to override specific environment keys
.confy.prod.yml. - Load Confy as follows.
import "package:confy/confy.dart";
main() {
// to load configuration files global and another one based on APP_ENV environment.
confyLoad(environmentResolver: () => Platform.environment["APP_ENV"]);
print("name ${confy("NAME")}");
print("description ${confy("DESC")}");
print("environment path: ${confy("PATH")}");
final v = confy("APP.VERSION"); // returns Map
final appVersion = "${v?["MAJOR"]}.${v?["MINOR"]}.${v?["PATCH"]}";
print("app version: $appVersion");
print("key not exist ${confy("MY_SECRET", defaultValue: 123)}");
// ... your code
}