vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Invalid docs for ConfigRetriever #112

Closed UglyHobbitFeet closed 4 years ago

UglyHobbitFeet commented 4 years ago

It appears that the config retriever is passing futures by default. I don't see anything in the docs about this: https://vertx.io/docs/vertx-config/js/#_configuring_a_single_verticle

The code below works, and the docs may want to change to reflect something similar

import { ConfigRetriever } from '@vertx/config';
import { ConfigStoreOptions, ConfigRetrieverOptions } from '@vertx/config/options';

const fileStore = new ConfigStoreOptions().setType('file')
  .setFormat('properties')
  .setConfig({ 'path': '/foo/bar.properties' });
const configRetrieverOptions = new ConfigRetrieverOptions().addStore(fileStore);
const retriever = ConfigRetriever.create(vertx, configRetrieverOptions);

retriever.getConfig((futureResult, json_err) => {
  if (json_err != null) {
    console.error(json_err);
    return;
  }
  futureResult.onSuccess((result) => {
    console.log('From Future:', JSON.stringify(result)));
    // Do your work in here instead
  );}
});
pmlopes commented 4 years ago

the docs for es4x are now being processed on the es4x site, the link above related to vertx-lang-js (Nashorn).

UglyHobbitFeet commented 4 years ago

Can we at least modify the top of the existing doc to state that it is only for vertx-lang-js and not ES4X? Possibly providing links for ES4X versions? I feel like I wasted a lot of time not knowing that and that others will do the same.