Esta es la tarea que tengo que ejecutar, debería generarme un token, he intentado con rake Config:set_token
y no funciona, me muestra este error:
rake aborted!
ArgumentError: Secret should not be nil.
/home/techsystems/Projects/ts_fiscal_api/app/helpers/application_helper.rb:54:in new'
/home/techsystems/Projects/ts_fiscal_api/app/helpers/application_helper.rb:54:in encrypt'
/home/techsystems/Projects/ts_fiscal_api/lib/tasks/set_token.rake:5:in block (2 levels) in <top (required)>'
/home/techsystems/.rbenv/versions/2.2.5/bin/bundle:23:in load'
/home/techsystems/.rbenv/versions/2.2.5/bin/bundle:23:in `<main>'
Tasks: TOP => Config:set_token
(See full trace by running task with --trace)
Config.rake:
namespace :Config do
desc "Establecer token de seguridad"
task set_token: :environment do
include ActionView::Helpers::ApplicationHelper
secret_token = encrypt(ENV['cadena'])
token_key = Config.find_by_key('token')
if token_key != nil
token_key.update(value:secret_token)
else
Config.create(key:'token',value:secret_token)
end
puts secret_token
end
end
new' /home/techsystems/Projects/ts_fiscal_api/app/helpers/application_helper.rb:54:in
encrypt' /home/techsystems/Projects/ts_fiscal_api/lib/tasks/set_token.rake:5:inblock (2 levels) in <top (required)>' /home/techsystems/.rbenv/versions/2.2.5/bin/bundle:23:in
load' /home/techsystems/.rbenv/versions/2.2.5/bin/bundle:23:in `<main>' Tasks: TOP => Config:set_token (See full trace by running task with --trace)