How to setup admin user in config.json in nodebb
-
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 accountplease 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\\\":\\\"[email protected]\\\",\\\"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. -
@徐再贤 as baris demonstrated, you can set initial values for admin username, email, and password by passing in a config object. What are looking for?
-
@徐再贤 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 ~