GithubHelp home page GithubHelp logo

Comments (14)

ripienaar avatar ripienaar commented on July 1, 2024

You should be able to swop the backslashes for forward slashes and it should work, i think

from natscli.

kmpm avatar kmpm commented on July 1, 2024

Yes it works if I edit the context.
So is the fault with nsc that created the context or natscli where it is used?
The context is technically correct since windows use backslash but where would you like the issue fixed?

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

Can you paste your context file please? C:\Users\<redacted username>\.config\nats\context\ngsleafnode.json

from natscli.

kmpm avatar kmpm commented on July 1, 2024

I have traced the issue to somewhere in the parse func in nats-server/conf/parse.go

The context looks like this...

# Friendly description for this context shown when listing contexts
description: synadia (Synadia Communications Inc.)

# A comma separated list of NATS Servers to connect to
url: tls://connect.ngs.global

# Connect using a specific username, requires password to be set
user: ""
password: ""

# Connect using a NATS Credentials stored in a file
creds: C:\Users\<redacted username>\.local\share\nats\nsc\keys\creds\synadia\<redacted account>\default.creds

# Connect using a NKey derived from a seedfile
nkey: ""

# Configures a token to pass in the connection
token: ""

# Sets a x509 certificate to use, both cert and key should be set
cert: ""
key: ""

# Sets an optional x509 trust chain to use
ca: ""

# Retrieves connection information from 'nsc'
#
# Example: nsc://Acme+Inc/HR/Automation
nsc: ""

# Use a custom inbox prefix
#
# Example : _INBOX.private.userid
inbox_prefix: ""

# Sets a color scheme to use for the nats command line tool
# this will influence table color choices allowing different
# contexts to be visually distinguished.
#
# Valid values are:
#
#   rounded
#   double
#   yellow
#   blue
#   cyan
#   green
#   magenta
#   red
#
# When not set "rounded" is used
color_scheme: ""

# Connects to a specific JetStream domain
jetstream_domain: ""

# Subject used as a prefix when accessing the JetStream API if imported from another account
jetstream_api_prefix: ""

# Subject prefix used to access JetStream events if imported from another account
jetstream_event_prefix: ""

# Use a Socks5 proxy like ssh to connect to the NATS server URLS
#
# Example: socks5://example.net:1090
socks_proxy: ""

from natscli.

kmpm avatar kmpm commented on July 1, 2024

In json

{
  "ca": "",
  "cert": "",
  "color_scheme": "",
  "creds": "C:\\Users\\<redacted user>\\.local\\share\\nats\\nsc\\keys\\creds\\synadia\\<redacted account>\\default.creds",
  "description": "synadia (Synadia Communications Inc.)",
  "inbox_prefix": "",
  "jetstream_api_prefix": "",
  "jetstream_domain": "",
  "jetstream_event_prefix": "",
  "key": "",
  "nkey": "",
  "nsc": "",
  "password": "",
  "socks_proxy": "",
  "token": "",
  "url": "tls://connect.ngs.global",
  "user": ""
}

from natscli.

kmpm avatar kmpm commented on July 1, 2024

The temporary server config created looks like


listen: 0.0.0.0:27260
server_name: nats_development
debug: false
trace: false
system_account: SYSTEM
logtime: false
jetstream {
    store_dir: C:\\Users\\<redacted user>\\.local\\share\\nats\\nats_development
	domain: NATS_DEVELOPMENT
}

accounts {
    USER: {
        jetstream: enabled
        users: [
            {
                user: "local",
                password: "<redacted hash>"
            }
        ]

        imports: [
            {service: {account: SERVICE, subject: "service.>"}, to: "imports.SERVICE.>"}
        ]
    }

    SERVICE: {
        jetstream: enabled
        users: [
            {
                user: "service",
                password: "<redacted hash>"
            }
        ]

        exports: [
            {service: service.>}
        ]
    }

    SYSTEM: {
        users: [{"user": "system", "password": "<redacted hash>"}],
    }
}

leafnodes {
    remotes = [
        {
            url: "tls://connect.ngs.global",
            credentials: "C:\Users\<redacted user>\.local\share\nats\nsc\keys\creds\synadia\<redacted account>\default.creds",
            account: "USER"
        }
    ]
}

from natscli.

kmpm avatar kmpm commented on July 1, 2024

Looks as the remote credentials path doesn't get correctly escaped before the config template is processed.

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

OK - I am a bit surprised the docs led a NGS user down the path of nats server run as its a very experimental feature.

But yes, seems if we escape these strings when writing the server config probably it will work

from natscli.

kmpm avatar kmpm commented on July 1, 2024

The output from your call to shellescape is the same as the input, so no effect.

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

The problem is we add yours then anyone who had already fixed this up will break...but anyway server run is not supported part of the cli (even hidden in --help) so will take your fix ontop of mine.

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

OK try main again, I should have just taken yours sorry about that.

from natscli.

kmpm avatar kmpm commented on July 1, 2024

Commit bcc57a2 now works, great, thanks..... but.
How about implementing the same method for StoreDir and remove the previous workaround ( about line 261-264 ).
Also add quotes to the StorDir in the template so that paths with spaces might work.
(see my PR for reference)

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

OK, I will have to get to this another day unfortunately - unless you want to update your PR or send a new one

from natscli.

kmpm avatar kmpm commented on July 1, 2024

I can make a new one. No worries

from natscli.

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.