Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

Loading datacenter config contains a hidden nextTick even though all config loading is synchronous. #31

Open
@lxe

Description

@lxe

https://github.com/uber/zero-config/blob/master/index.js#L30-L34

        // throw error async. this allows for breaking a 
        // circular dependency between config & logger.
        process.nextTick(function () {
            config.emit('error', err);
        });

All config loading is synchrnonous. fetchConfig() returns a result, and THEN throws an error, which is undesirable and confusing. For example:

test('Non-existent dc test', function assert(t) {
  t.throws(function shouldThrow() {
    var config = zc({
      dc: '/does/not/exist',
    });
  }, /MissingDatacenterFileError/);

  t.end();
});

^ This tests will fail, and THEN the test suite will crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions