Giter Site home page Giter Site logo

Comments (9)

calvn avatar calvn commented on May 18, 2024

@sethvargo I was wondering if you have looked into this. I can start working on this and send you a PR if you are busy

from consul-replicate.

sethvargo avatar sethvargo commented on May 18, 2024

@cleung2010 thank you for opening an issue.

The JSON you supplied is not a direct translation from the HCL. Top-level keys in HCL are actually keys to arrays of objects in JSON, i.e.:

consul = "127.0.0.1:8500"
token = "abcd1234"
retry = "10s"
max_stale = "10m"

auth {
  enabled = true
  username = "test"
  password = "test"
}

becomes:

{
  "auth": [
    {
      "enabled": true,
      "password": "test",
      "username": "test"
    }
  ]
}

Are you experiencing issues when you specify the prefixes as an array of objects, because that should definitely work?

from consul-replicate.

calvn avatar calvn commented on May 18, 2024

So I am not using HCL at all as my config file. I want to use multi-prefix via JSON. The readme says I can do it like so in HCL:

prefix {
  source = "global@nyc1"
  destination = "local/nyc1"
}

prefix {
  source = "global@nyc2"
  destination = "local/nyc2"
}

But how can I do this in JSON since keys need to be unique (thus two prefix wouldn't work)?

from consul-replicate.

sethvargo avatar sethvargo commented on May 18, 2024

@cleung2010 the same as my example for auth (and the example you provided yourself above):

{
  "prefix": [
    {
      "source": "...",
      "destination": "..."
    }
  ]
}

from consul-replicate.

calvn avatar calvn commented on May 18, 2024

Oh nice, and I assume the same would apply for destination. I am going to go ahead and close the issue, thanks for clearing this up! It wouldn't hurt to provide a JSON example on the readme for people less familiar with explicit translations done by HCL :)

from consul-replicate.

sethvargo avatar sethvargo commented on May 18, 2024

@cleung2010 no, destination must be a string. It's the same as the command line. If you want multiple destinations, you need to specify the prefix multiple times.

from consul-replicate.

calvn avatar calvn commented on May 18, 2024

So

{
"prefix": [
        {
            "destination": "local/nyc1",
            "source": "global@nyc1"
        },
        {
            "destination": "local/nyc2",
            "source": "global@nyc2"
        },
        {
            "destination": "temp/nyc2",
            "source": "global@nyc2"
        }
    ]
}

Instead of

{
"prefix": [
        {
            "destination": "local/nyc1",
            "source": "global@nyc1"
        },
        {
            "destination": [
                "local/nyc2",
                "temp/nyc2"
            ],
            "source": "global@nyc2"
        }
    ]
}

from consul-replicate.

sethvargo avatar sethvargo commented on May 18, 2024

Yes

from consul-replicate.

calvn avatar calvn commented on May 18, 2024

Cool, thanks!

from consul-replicate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.