Chaging adhearsion config with out restarting adhearsion application

29 views
Skip to first unread message

Vijay

unread,
Jan 29, 2019, 6:32:35 AM1/29/19
to Adhearsion
Hi,

I would like to know if running Adhearsion application config can be changed without restarting the application.  

I understand that SIGALRM can be used to toggle on or off TRACE level logging. Similarly, can any other signal can be used to force the Adhearsion application to re read the config.

Thanks 
Vijay

Stephen F. George

unread,
Jan 29, 2019, 7:43:06 AM1/29/19
to Adhearsion
Hello Vijay,

My suggestion would be to consider adding http endpoints to your adhearsion application to allow you to manipulate various config settings of the Adhearsion core config as well as for Adhearsion plugins.

The Virginia gem allows you to easily bolt-on a Reel based web server to Adhearsion.  Any endpoints you add to Virginia will be running in the same process as Adhearsion, and thus can easily manipulate configuration.

Virginia supports any rack-based web framework.  Here's an example endpoint using Sinatra:


require 'sinatra/base'

put '/default_voice' do
  Adhearsion.config.media.default_voice = params[:default_voice] if params[:default_voice]
  standard_response "default_voice changed to #{Adhearsion.config.media.default_voice}.\n"
end

# Sinatra helpers
helpers do
  def standard_response(response, status_code = 200, headers = {})
    [status_code, headers, [response]]
  end
end


You could invoke this externally using a program like cURL like so:

curl -f -s -S -H 'Accept: application/json' -X PUT -d 'default_voice=Larry' http://localhost:8080/default_voice

#=> default_voice changed to Larry.


Luca Pradovera

unread,
Jan 29, 2019, 8:41:42 AM1/29/19
to adhea...@googlegroups.com
Hello,
additionally, the current version fo Adhearsion 3 (release coming soon, I promise!) bundles a more advanced version of the HTTP server right in the main library. You can just add your actions to config.ru in the familiar Sinatra syntax.

Best regards,
Luca

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adhearsion+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vijay

unread,
Jan 30, 2019, 1:50:03 AM1/30/19
to Adhearsion
Thank you Stephen.

Vijay

unread,
Jan 30, 2019, 4:24:16 AM1/30/19
to Adhearsion
Thank you Luca. Great news.., looking forward to Adhearsion 3 release.

Andrius Kairiukstis

unread,
Jan 30, 2019, 4:39:34 AM1/30/19
to adhea...@googlegroups.com
Awesome, I did not knew that it works that way; only use Virginia to add api capabilities 
--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adhearsion+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages