Homebrew and usage

This commit is contained in:
Filippo Valsorda
2018-06-26 00:39:02 -04:00
parent c59b5d9d13
commit 6a3cad1731
3 changed files with 39 additions and 5 deletions

18
HomebrewFormula/mkcert.rb Normal file
View File

@@ -0,0 +1,18 @@
class Mkcert < Formula
desc "Simple tool to make locally-trusted development certificates"
homepage "https://github.com/FiloSottile/mkcert"
head "https://github.com/FiloSottile/mkcert.git"
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
mkcertpath = buildpath/"src/github.com/FiloSottile/mkcert"
mkcertpath.install buildpath.children
cd mkcertpath do
system "go", "build", "-o", bin/"mkcert"
prefix.install_metafiles
end
end
end

View File

@@ -20,18 +20,18 @@ Created a new certificate valid for the following names 📜
The certificate is at "./example.com+4.pem" and the key at "./example.com+4-key.pem" ✅ The certificate is at "./example.com+4.pem" and the key at "./example.com+4-key.pem" ✅
``` ```
![Chrome screenshot](https://user-images.githubusercontent.com/1225294/41887838-7acd55ca-78d0-11e8-8a81-139a54faaf87.png) <p align="center"><img width="444" alt="Chrome screenshot" src="https://user-images.githubusercontent.com/1225294/41887838-7acd55ca-78d0-11e8-8a81-139a54faaf87.png"></p>
Obtaining certificates from real CAs for development can be dangerous or impossible (for hosts like `localhost` or `127.0.0.1`), but self-signed certificates cause trust errors. Managing your own CA is the best solution, but usually involves arcane commands, specialized knowledge and manual steps. Using certificates from real CAs for development can be dangerous or impossible (for hosts like `localhost` or `127.0.0.1`), but self-signed certificates cause trust errors. Managing your own CA is the best solution, but usually involves arcane commands, specialized knowledge and manual steps.
mkcert automatically creates and installs a local CA in the system root store, and generates locally-trusted certificates for any hosts. mkcert automatically creates and installs a local CA in the system root store, and generates locally-trusted certificates.
## Installation ## Installation
On macOS, use Homebrew. On macOS, use Homebrew.
``` ```
TODO brew install --HEAD FiloSottile/mkcert/mkcert
``` ```
On Linux, use [the pre-built binaries](https://github.com/FiloSottile/mkcert/releases), or build from source. On Linux, use [the pre-built binaries](https://github.com/FiloSottile/mkcert/releases), or build from source.

18
main.go
View File

@@ -81,7 +81,23 @@ func (m *mkcert) Run(args []string) {
} }
if len(args) == 0 { if len(args) == 0 {
log.Println("Usage: TODO") log.Printf(`
Usage:
$ mkcert -install
Install the local CA in the system trust store.
$ mkcert example.org
Generate "example.org.pem" and "example.org-key.pem".
$ mkcert example.com myapp.dev localhost 127.0.0.1 ::1
Generate "example.com+4.pem" and "example.com+4-key.pem".
$ mkcert -uninstall
Unnstall the local CA (but do not delete it).
Change the CA certificate and key storage location by setting $CAROOT.
`)
return return
} }