MCPcopy
hub / github.com/puma/puma-dev / InstallIntoSystem

Function InstallIntoSystem

dev/setup_darwin.go:109–206  ·  view source on GitHub ↗
(config *InstallIntoSystemArgs)

Source from the content-addressed store, hash-verified

107}
108
109func InstallIntoSystem(config *InstallIntoSystemArgs) error {
110 if sudo := os.Getenv("SUDO_USER"); sudo != "" {
111 return fmt.Errorf("cannot run as superuser")
112 }
113
114 err := SetupOurCert()
115 if err != nil {
116 return err
117 }
118
119 binPath, err := osext.Executable()
120 if err != nil {
121 return errors.Context(err, "calculating executable path")
122 }
123
124 fmt.Printf("* Use '%s' as the location of puma-dev\n", binPath)
125
126 var userTemplate = `<?xml version="1.0" encoding="UTF-8"?>
127<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
128<plist version="1.0">
129<dict>
130 <key>Label</key>
131 <string>io.puma.dev</string>
132 <key>ProgramArguments</key>
133 <array>
134 <string>%s</string>
135 <string>-launchd</string>
136 <string>-dir</string>
137 <string>%s</string>
138 <string>-d</string>
139 <string>%s</string>
140 <string>-timeout</string>
141 <string>%s</string>
142 <string>-no-serve-public-paths</string>
143 <string>%s</string>
144 </array>
145 <key>KeepAlive</key>
146 <true/>
147 <key>RunAtLoad</key>
148 <true/>
149 <key>Sockets</key>
150 <dict>
151 <key>Socket</key>
152 <dict>
153 <key>SockNodeName</key>
154 <string>0.0.0.0</string>
155 <key>SockServiceName</key>
156 <string>%d</string>
157 </dict>
158 <key>SocketTLS</key>
159 <dict>
160 <key>SockNodeName</key>
161 <string>0.0.0.0</string>
162 <key>SockServiceName</key>
163 <string>%d</string>
164 </dict>
165 </dict>
166 <key>StandardOutPath</key>

Callers 3

mainFunction · 0.92
installIntoTestContextFunction · 0.85

Calls 2

MustExpandFunction · 0.92
SetupOurCertFunction · 0.85

Tested by 2

installIntoTestContextFunction · 0.68