Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将我的 clientId 和 Facebook 的秘密保存在安全的位置,而不是提交到 github 或与整个开发团队共享。
大多数人会在 facebook 上创建开发应用程序吗?
好吧,您可以将它们设置为环境变量。在 shell 提示符下的开发机器中,您可以执行以下操作
$ export clientID="xxxxx" $ export clientSecret="xxxxx"
在您的 node.js 代码中,这 2 个变量现在可以作为公共变量使用
process.env.ClientID process.env.ClientSecret