@pitaj said:
you could just add some JavaScript to parse it client side.
That is more than likely what I'll have to do for now until this can passed globally. Thanks @pitaj
For build promotions we have to auto create the admin account from Jenkins or some environment variable
can we use config.json to setup admin account
please guide us, How can we use the below command.
./nodebb setup [options] [config]
We refer the below link but not successed:
https://community.nodebb.org/topic/14068/setting-up-nodebb-for-ci-cd-pipeline
You should be able to pass in initial options as a json string
node app --setup=\"{\\\"url\\\":\\\"http://127.0.0.1:4567\\\",\\\"secret\\\":\\\"abcdef\\\",\\\"database\\\":\\\"mongo\\\",\\\"mongo:host\\\":\\\"127.0.0.1\\\",\\\"mongo:port\\\":27017,\\\"mongo:username\\\":\\\"\\\",\\\"mongo:password\\\":\\\"\\\",\\\"mongo:database\\\":0,\\\"admin:username\\\":\\\"admin\\\",\\\"admin:email\\\":\\\"test@example.org\\\",\\\"admin:password\\\":\\\"123456\\\",\\\"admin:password:confirm\\\":\\\"123456\\\"}\"
Not sure if ./nodebb setup
also takes a json string for initial values @pitaj?
@baris it's also an option on ./nodebb setup
. Look at ./nodebb help setup
for options.
It's inconvenient that we cannot set default admin username/password by values provided by nconf .
I wonder if threr is anyone agree with me?
I'm glad to create a pull request.
@徐再贤 as baris demonstrated, you can set initial values for admin username, email, and password by passing in a config object. What are looking for?
@pitaj we have to escape character first. It's inconvenient.Why not get these initial values from a config file instead of a stringify object.
@徐再贤 you can read them from a config file and pass that as the argument. Have you tried something like this?
./nodebb setup "$(cat config.base.json)"
Or I think you can pass them as environment variables, so you can have a .env file and do this:
export admin__username="admin"
export admin__password="password"
export admin__password__confirm="password"
...
./config.base.env && ./nodebb setup
That's just an example off the top of my head, it may not actually work as typed, I haven't tried it.
@pitaj said in How to setup admin user in config.json in nodebb:
export admin__username="admin"
export admin__password="password"
export admin__password__confirm="password"
using output of cat
command is a good choice , i will try this.
but i don't think using enviroment variables will work.
thanks ~