func New(httpPort string, useStaging bool, p string) (*LetsEncrypt, error) {
	le := &LetsEncrypt{
		HTTPPort: httpPort,
	}

	// Use staging environment if needed
	var acmeDir = acme.LetsEncryptURL
	if useStaging {
		acmeDir = "https://acme-staging-v02.api.letsencrypt.org/directory"
	}

	le.AcmeClient = &acme.Client{
		DirectoryURL: acmeDir,
		UserAgent:    "BitMaelum v" + internal.Version.String(),
	}

	// Create context
	le.Ctx, le.Cancel = context.WithTimeout(context.Background(), 2*time.Minute)

	// Load account information
	key, account, err := getAccountFromAcmeDir(p)
	if err == nil {
		le.Key = key
		le.Account = account
		le.AcmeClient.Key = key

		return le, nil
	}

	return le, nil
}
// New creates a new LetsEncrypt instance and loads account info (if present)
New creates a new LetsEncrypt instance and loads account info (if present)
// New creates a new LetsEncrypt instance and loads account info ( if present )
func New(httpPort string, useStaging bool, p string) (*LetsEncrypt, error) {
	le := &LetsEncrypt{
		HTTPPort: httpPort,
	}
	var acmeDir = acme.LetsEncryptURL
	if useStaging {
		acmeDir = "https://acme-staging-v02.api.letsencrypt.org/directory"
	}
	le.AcmeClient = &acme.Client{
		DirectoryURL: acmeDir,
		UserAgent:    "BitMaelum v" + internal.Version.String(),
	}
	le.Ctx, le.Cancel = context.WithTimeout(context.Background(), 2*time.Minute)
	key, account, err := getAccountFromAcmeDir(p)
	if err == nil {
		le.Key = key
		le.Account = account
		le.AcmeClient.Key = key
		return le, nil
	}
	return le, nil
}
func New ( httpPort string , useStaging bool , p string ) ( * LetsEncrypt , error ) { le := & LetsEncrypt { HTTPPort : httpPort , } var acmeDir = acme . LetsEncryptURL if useStaging { acmeDir = " " } le . AcmeClient = & acme . Client { DirectoryURL : acmeDir , UserAgent : " " + internal . Version . String ( ) , } le . Ctx , le . Cancel = context . WithTimeout ( context . Background ( ) , 2 * time . Minute ) key , account , err := getAccountFromAcmeDir ( p ) if err == nil { le . Key = key le . Account = account le . AcmeClient . Key = key return le , nil } return le , nil }
New creates a new LetsEncrypt instance and loads account info (if present)
New creates a new LetsEncrypt instance and loads account info ( if present )
// Use staging environment if needed // Create context // Load account information