fix no file errors: it may throw error if the specified file not exists:
Errno::ENOENT: No such file or directory @ rb_sysopen
Signed-off-by: Luan Shengde shdluan@163.com --- container/mail-robot/lib/apply-account.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/container/mail-robot/lib/apply-account.rb b/container/mail-robot/lib/apply-account.rb index 798546a..6b9bdfe 100755 --- a/container/mail-robot/lib/apply-account.rb +++ b/container/mail-robot/lib/apply-account.rb @@ -56,7 +56,11 @@ class ApplyAccount @es_port = ES_PORT
# email info file for account issuers. - @account_issuer = YAML.load_file ENV['ACCOUNT_ISSUER'] + @account_issuer = if File.exists? ENV['ACCOUNT_ISSUER'] + YAML.load_file ENV['ACCOUNT_ISSUER'] + else + {} + end
@my_info = {} end