douhuan7862 2015-03-15 18:44
浏览 36
已采纳

App Engine在Go中读取本地文件

Im using go and cloud endpoints and i have a pem file that im using him in order to create signed URL.
When im running my app locally and im providing a full path to the ioutil.ReadFile method its working well.

On the server i tried several option on server like this but i get file not found...

APPNAME/files/key.pem
  1. What is the correct path to the file?

  2. Should i use memcached instead of ioutil.ReadFile for reading the pem file ?

  • 写回答

1条回答 默认 最新

  • dongsuyou6938 2015-03-15 18:51
    关注

    App Engine applications run with CWD set to the root of the application (the directory containing app.yaml). If your application has the directory structure

    - APPNAME
     - files
      - key.pem
     - app.yaml
    

    then use the path files/key.pem to open the file.

    If the .pem file is part of your application's static data, then it's best to read the data from the file system.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测