How to programmatically set the default account ID and Password as part of install?

Added by Jon Jaroker over 5 years ago

Hello, I asked this question on the user's help forum but realize now that it may be more of a developer question as it deals with coding.

http://www.redmine.org/boards/2/topics/30812

I install redmine 2.0 via puppet (an automation tool) and wish to set the default account's password. Can someone please suggest the best way to do this. I am new to redimine and not familiar with the codebase.

Which of these approaches would be best to implement:

  • modify db/migrate/001_setup.rb? This approach may be difficult to maintain if future releases change this file
  • is it possible to add a custom setup script in db/migrate to update the database record?
  • modify the database table directly after db:migrate?
  • could configuration.yml be used to set the password? I can't find any information about this in the codebase

Thank you,
Jon

Replies (1)

RE: How to programmatically set the default account ID and Password as part of install? - Added by Etienne Massip over 5 years ago

Try some

rails runner -e production "admin = User.first.where({:admin => true}); admin.password = '<new password>'; admin.password_confirmation = true; admin.save!" 

Didn't try though, just inspired by #9071.

(1-1/1)