Vheissu/aurelia-configuration

Get method always return void object

ShauniArima opened this issue · 1 comments

Hello,
When I want to read the properties of my configuration file with the "get" method, that always return a void object.

There is the config.json file:

{
    "name": "My application",
    "version": "0.1"
}

The main.js file:

aurelia.use
    .standardConfiguration()
    .plugin('aurelia-configuration', config => {
        let name = config.get('name');
        console.log(config, name);
    });

And the output in my console:

Object { environment: "default", environments: null, directory: "config", config_file: "config.json", cascade_mode: true, _config_object: Object, _config_merge_object: Object } null

If you look at this file : https://github.com/Vheissu/aurelia-configuration/blob/master/src/index.ts

I think the behaviour you get is totally normal since the config hasn't loaded yet when you try to access it. Try to get your variable in your application, not into plugins configuration callback. Should work.

Just tried it on my end here and get the same result by trying to access it directly in the plugin configuration callback. Anywhere else in my code, the same key would work just fine and return the expected value.