drachtio / drachtio-freeswitch-modules

A collection of open-sourced freeswitch modules that I use in various drachtio applications
MIT License
175 stars 119 forks source link

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

Open herbiel opened 4 years ago

herbiel commented 4 years ago

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 ?

davehorton commented 4 years ago

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
herbiel commented 4 years ago

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.