package https import ( "path/filepath" "strings" "github.com/miekg/coredns/core/assets" ) // storage is used to get file paths in a consistent, // cross-platform way for persisting Let's Encrypt assets // on the file system. var storage = Storage(filepath.Join(assets.Path(), "letsencrypt")) // Storage is a root directory and facilitates // forming file paths derived from it. type Storage string // Sites gets the directory that stores site certificate and keys. func (s Storage) Sites() string { return filepath.Join(string(s), "sites") } // Site returns the path to the folder containing assets for domain. func (s Storage) Site(domain string) string { return filepath.Join(s.Sites(), domain) } // SiteCertFile returns the path to the certificate file for domain. func (s Storage) SiteCertFile(domain string) string { return filepath.Join(s.Site(domain), domain+".crt") } // SiteKeyFile returns the path to domain's private key file. func (s Storage) SiteKeyFile(domain string) string { return filepath.Join(s.Site(domain), domain+".key") } // SiteMetaFile returns the path to the domain's asset metadata file. func (s Storage) SiteMetaFile(domain string) string { return filepath.Join(s.Site(domain), domain+".json") } // Users gets the directory that stores account folders. func (s Storage) Users() string { return filepath.Join(string(s), "users") } // User gets the account folder for the user with email. func (s Storage) User(email string) string { if email == "" { email = emptyEmail } return filepath.Join(s.Users(), email) } // UserRegFile gets the path to the registration file for // the user with the given email address. func (s Storage) UserRegFile(email string) string { if email == "" { email = emptyEmail } fileName := emailUsername(email) if fileName == "" { fileName = "registration" } return filepath.Join(s.User(email), fileName+".json") } // UserKeyFile gets the path to the private key file for // the user with the given email address. func (s Storage) UserKeyFile(email string) string { if email == "" { email = emptyEmail } fileName := emailUsername(email) if fileName == "" { fileName = "private" } return filepath.Join(s.User(email), fileName+".key") } // emailUsername returns the username portion of an // email address (part before '@') or the original // input if it can't find the "@" symbol. func emailUsername(email string) string { at := strings.Index(email, "@") if at == -1 { return email } else if at == 0 { return email[1:] } return email[:at] } iler-02-new-build Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/examples/kitchen-sink (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2021-05-13chore: release astro-vscodeGravatar Nate Moore 6-148/+30
2021-05-13Version Packages (#195)Gravatar github-actions[bot] 23-65/+43
2021-05-13Support for import suggestions in the languageserver (#204)Gravatar Matthew Phillips 6-12/+32
2021-05-13Fix Svelte build output (#201)Gravatar Nate Moore 4-8/+14
2021-05-12[wip] Fix CI (#202)Gravatar Drew Powers 28-219/+191
2021-05-11VS Code extension (#197)Gravatar Matthew Phillips 7-20/+182
2021-05-11Fix workflows! (#198)Gravatar Nate Moore 3-2/+4
2021-05-11Add Astro.request.canonicalURL and Astro.site to global (#199)Gravatar Drew Powers 25-98/+234
2021-05-11Fix portfolio example (#196)Gravatar Drew Powers 2-3/+5
2021-05-10fix: build stuck on unhandled promise reject (#191)Gravatar Kevin (Kun) "Kassimo" Qian 2-2/+13
2021-05-10Allow default import component to be renamed based on import statement defaul...Gravatar Kevin (Kun) "Kassimo" Qian 3-8/+30
2021-05-08Add more docs on styling (#186)Gravatar Drew Powers 1-3/+321
2021-05-08Fix running the extension (#181)Gravatar Matthew Phillips 5-11/+37