Skip to content

Commit 429218a

Browse files
Enable oidc-agent as a persistent service on macOS (#28)
This update makes `oidc-agent` a persistent background service on macOS. Added a `service` block for managing `oidc-agent` with `brew services`. Set up environment variable `PATH` to support `oidc-agent` calls (i.e. `oidc-prompt`). Set the socket path to a "trustworthy" location: `~/Library/Caches/oidc-agent/oidc-agent.sock` Resolves: indigo-dc/oidc-agent#341
1 parent 7d86a68 commit 429218a

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Formula/oidc-agent.rb

+19-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,25 @@ def install
2525
system "make", "install", "PREFIX=#{prefix}"
2626
end
2727

28+
service do
29+
run [opt_bin/"oidc-agent", "-a", "~/Library/Caches/oidc-agent/oidc-agent.sock", "-d"]
30+
keep_alive true
31+
working_dir var
32+
log_path var/"log/oidc-agent.log"
33+
error_log_path var/"log/oidc-agent.log"
34+
environment_variables PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/homebrew/bin"
35+
end
36+
37+
def caveats
38+
<<~EOS
39+
To start oidc-agent as a background service now and restart at login:
40+
brew services start oidc-agent
41+
If you don't need a background service, you can run the following instead:
42+
oidc-agent -a ~/Library/Caches/oidc-agent/oidc-agent.sock -d
43+
EOS
44+
end
45+
2846
test do
29-
system "true"
47+
assert_match version.to_s, shell_output("#{bin}/oidc-agent --version")
3048
end
3149
end

0 commit comments

Comments
 (0)