如何在 IDE 中使用 sops 作为外部工具?

How do I use sops as an External Tool in my IDE?

我想使用 sops 在我的 IDE (Intellij) 中编辑文件,但我不确定如何最好地将其设置为外部工具。

我发现了这些相关问题:

IntelliJ IDEA 不支持 --wait,不能通过 EDITOR 环境使用。

查看 this issue 和链接的副本。

外部工具将不起作用。这可以通过实施 IntelliJ IDEA plug-in 来支持,它将与命令行工具集成以透明地 encrypt/decrypt 您正在编辑的文件。

IntelliJ IDEA 至少 2020.2 现在支持 --wait

https://www.jetbrains.com/help/idea/working-with-the-ide-features-from-command-line.html#arguments

我试过了

export EDITOR="idea --wait"
sops secret.yaml

不幸的是,即使在想法中有消息

,它也不起作用

Activated from command line: Command line will be waiting until the file '/Users/user/Development/../secret.yaml' has been closed.

从 2020.3.2 开始,我可以确认将环境编辑器设置为

"C:\Program Files\JetBrains\GoLand 2020.3.2\bin\goland.exe" --wait

然后使用 sops 对我来说效果很好(在 windows 中)。每次您想要保存更改时都需要按 Ctrl-S,因为打开的文件被视为您正在处理的项目的外部文件。