Git Product home page Git Product logo

Comments (11)

sasbury avatar sasbury commented on June 24, 2024

Can you send me a sample of your config file and command line (they can be fake, just want to see what flags and contents you are using.) I wrote a test and didn't see this problem. I will check in the test regardless, but want to make sure it replicates what you are doing.

from nats-account-server.

wutkemtt avatar wutkemtt commented on June 24, 2024

Thanks for the fast response. We used the config below, trying to use the account server as a master for another account server. In the first step we tried to reach the account server from a nats on another server.

OperatorJWTPath: "X:/some_path/NATS.jwt" systemaccountjwtpath: "X:/some_path/SYS.jwt" http: { host: "HOSTA", port: 9090, readtimeout: 5000, writetimeout: 5000 } store: { dir: "D:/nats/as_store", readonly: false, shard: false } logging: { debug: true, pid: true, time: true, trace: false, colors: true } nats: { servers: ["nats://HOSTA:4243","nats://HOSTB:4243"], usercredentials: "X:/some_path/admin.creds", ConnectTimeout: 5000, #MaxReconnects: 50 ReconnectWait: 10000 }

We were not able to access the account server on HOSTA from HOSTB. After setting the command line option "-hp" with the same value the account server was reachable.
nats-account-server.exe -c nats-account-server.config -ro -hp "HOSTA:9090"

Just before we realised, that when we set the host and port in the config and the server comes up, the log still shows the deafult resolver url:
[20144] 2019/06/19 09:25:48.398664 [←[32mINF←[0m] resolver: URL(http://localhost:9090/jwt/v1/accounts/)

After switching to commandline the log showed:
[19648] 2019/06/19 10:21:33.063197 [←[32mINF←[0m] resolver: URL(http://HOSTA:9090/jwt/v1/accounts/)

Hope, this will help to find the cause of the problem.

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

hm, that is almost exactly my test, can you check that you have the latest version from master, we may not have updated the releases or something.

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

wutkemtt let me know if you get a chance to try the latest code in master, i am curious if my test is somehow doing something different than your run.

from nats-account-server.

wutkemtt avatar wutkemtt commented on June 24, 2024

Hello,
I tried the latest code this morning with the same result. The http settings in the config file are completely ignored. Neither a different host nor a different port is used when set via config file. When adding the same values on the command line via the -hp option the setting is working.
Could it be that the complete http section is ignored within the config file ?
Other sections like store, logging and nats are working.

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

Hm, i updated my test with your config file and I still see the host coming through:

func TestStartWithConfigFileFlag(t *testing.T) {
	file, err := ioutil.TempFile(os.TempDir(), "config")
	require.NoError(t, err)

	configString := `
	OperatorJWTPath: "X:/some_path/NATS.jwt"
	systemaccountjwtpath: "X:/some_path/SYS.jwt"
	http: {
		host: "HOSTA",
		port: 9090,
		readtimeout: 5000,
		writetimeout: 5000 }
	store: {
		dir: "D:/nats/as_store",
		readonly: false,
		shard: false }
	logging: { 
		debug: true,
		pid: true,
		time: true,
		trace: false,
		colors: true }
	nats: { 
		servers: ["nats://HOSTA:4243","nats://HOSTB:4243"], 
		usercredentials: "X:/some_path/admin.creds", 
		ConnectTimeout: 5000,
		ReconnectWait: 10000
	}
	`

	fullPath, err := conf.ValidateFilePath(file.Name())
	require.NoError(t, err)

	err = ioutil.WriteFile(fullPath, []byte(configString), 0644)
	require.NoError(t, err)

	flags := Flags{
		ConfigFile: fullPath,
	}

	server := NewAccountServer()
	err = server.InitializeFromFlags(flags)
	require.NoError(t, err)

	require.Equal(t, "D:/nats/as_store", server.config.Store.Dir)
	require.Equal(t, 5000, server.config.HTTP.ReadTimeout)
	require.Equal(t, "HOSTA", server.config.HTTP.Host)
	require.Equal(t, 9090, server.config.HTTP.Port)
}

Does anything jump out to you, maybe i have a typo I am missing?

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

bah, i see the issue, the flags are defaulting to localhost:9090 and that has precedent. Testing a fix.

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

Should be fixed, confirmed with test and manually.

from nats-account-server.

sasbury avatar sasbury commented on June 24, 2024

If you can't confirm fix, please feel free to reopen.

from nats-account-server.

wutkemtt avatar wutkemtt commented on June 24, 2024

I can confirm the fix is working. Host and port are taken from config now and the server is reachable as expected. Thanks.

from nats-account-server.

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.