drachtio/drachtio-freeswitch-modules

Error: "GOOGLE_APPLICATION_CREDENTIALS" environment variable must be set to path of the file containing service account json key

Opened this issue · 2 comments

i have set environment on system,run export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcs_service_account_key.json"
and create config file like this
cat /usr/local/freeswitch/conf/autoload_configs/google_tts.xml




but if i load the mod_google_tts, it also tell me Error: "GOOGLE_APPLICATION_CREDENTIALS" environment variable must be set to path of the file containing service account json key

and this gcs_service_account_key.json is right,so can you help me ?

That log means that the environment variable has not been set -- at least not for the freeswitch process.

The best place to set the environment variable -- where I set it -- is in the systemd config file that manages freeswitch:

[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target

[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
EnvironmentFile=-/etc/default/freeswitch
Environment="LD_LIBRARY_PATH=/usr/local/lib"
Environment="GOOGLE_APPLICATION_CREDENTIALS=/home/admin/credentials/gcp.json"
ExecStart=/usr/local/freeswitch/bin/freeswitch -nc -nonat

That log means that the environment variable has not been set -- at least not for the freeswitch process.

The best place to set the environment variable -- where I set it -- is in the systemd config file that manages freeswitch:

[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target

[Service]
; service
Type=forking
PIDFile=/usr/local/freeswitch/run/freeswitch.pid
EnvironmentFile=-/etc/default/freeswitch
Environment="LD_LIBRARY_PATH=/usr/local/lib"
Environment="GOOGLE_APPLICATION_CREDENTIALS=/home/admin/credentials/gcp.json"
ExecStart=/usr/local/freeswitch/bin/freeswitch -nc -nonat

Thanks for your help .it work on my freeswitch too.