safe_config
safe_config copied to clipboard
Please add support to escape a $ dollar sign in a config file
I have a config file like that:
file "config.yaml":
password: $ya123m
when it is read from code below:
import 'dart:io';
import 'package:safe_config/safe_config.dart';
class AppConfig extends Configuration {
AppConfig(String fileName) : super.fromFile(File(fileName));
String password;
}
void main() {
var config = new AppConfig("config.yaml");
print("${config.password}"); // -> null????
}
I receive the unhandled exception: "Invalid configuration data for 'AppConfig'. Missing required values: 'password'"
If I remove $ from 'password' field this error goes away
It seems that there is no support to escape '$' sign in config files (although yaml package seems to support that). Could you please add that. I think there is already a standard where double '$' ($$) is used to escape $ sign.
I have already tried $$ and \$
Thank you very much
A leading (and only a leading) $ redirects the value to an environment variable. Adding a $$ escape sounds reasonable.