1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

A small improvement to LETSENCRYPT and LETSENCRYPTPROD

just  an improvement to the `LETSENCRYPT` in order to meet your needs,
it lets you configure the cache file to any directory  or to disable it
by passing "" as the second argument.

**OUTLINE**
```
// ListenLETSENCRYPT starts a server listening at the specific nat
address
// using key & certification taken from the letsencrypt.org 's servers
// it's also starts a second 'http' server to redirect all
'http://$ADDR_HOSTNAME:80' to the' https://$ADDR'
// it creates a cache file to store the certifications, for performance
reasons, this file by-default is "./letsencrypt.cache"
// if you skip the second parameter then the cache file is
"./letsencrypt.cache"
// if you want to disable cache then simple pass as second argument an
empty emtpy string ""
//
// example:
https://github.com/iris-contrib/examples/blob/master/letsencyrpt/main.go
//
// supports localhost domains for testing,
// NOTE: if you are ready for production then use
`$app.Serve(iris.LETSENCRYPTPROD("mydomain.com"))` instead
ListenLETSENCRYPT(addr string, cacheFileOptional ...string)
```

**OVERVIEW**
```
package main

import "github.com/kataras/iris"

func main() {
iris.Get("/", func(ctx *iris.Context) {
ctx.Write("Hello from SECURE SERVER!")
})

iris.ListenLETSENCRYPT("mydomain.com", "./mycachefile.cache)
}

```
This commit is contained in:
Gerasimos Maropoulos
2016-10-28 21:21:57 +03:00
parent 7eb520fc6b
commit 3243432d48
3 changed files with 90 additions and 15 deletions

View File

@@ -181,11 +181,16 @@ iris.Listen(":8080")
```go
iris.ListenTLS(":8080", "./ssl/mycert.cert", "./ssl/mykey.key")
```
`ListenLETSENCRYPT(addr string)`
`ListenLETSENCRYPT(addr string, cacheFileOptional ...string)`
```go
iris.ListenLETSENCRYPT(":8080")
iris.ListenLETSENCRYPT("mydomain.com")
```
```go
iris.Serve(iris.LETSENCRYPTPROD("myproductionwebsite.com"))
```
And
```go
ListenUNIX(addr string, mode os.FileMode)
Close() error