LogoLogo
GitHubGo reference
  • Overview
  • Basics
    • Actor Model
    • Supervision Tree
    • Generic Types
    • Node
    • Process
    • Meta-Process
    • Application
    • Links And Monitors
    • Events
    • Cron
    • Logging
    • CertManager
  • Actors
    • Actor
    • Supervisor
    • Pool
    • WebWorker
  • Meta Processes
    • TCP
    • UDP
    • Port
    • Web
  • Testing
    • Unit
  • extra library
    • Applications
      • Observer
    • Meta-Processes
      • WebSocket
    • Loggers
      • Colored
      • Rotate
    • Registrars
      • Saturn Сlient
    • Network Protocols
      • Erlang
  • Networking
    • Network Stack
    • Service Discovering
    • Network Transparency
    • Static Routes
    • Remote Spawn Process
    • Remote Start Application
  • Tools
    • Boilerplate Code Generation
    • Inspecting With Observer
    • Saturn - Central Registrar
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Basics

CertManager

Ergo Framework introduces gen.CertManager to simplify TLS certificate management. It enables live certificate updates without restarting the application and can be used across all network components like node acceptors, web, or TCP servers.

Use the function gen.CreateCertManager(cert tls.Certificate) to create a certificate manager. The gen.CertManager interface provides the following methods:

  • Update: Update the TLS certificate on the fly. All components using this CertManager will automatically receive the updated certificate.

  • GetCertificateFunc: Returns a closure to retrieve the TLS certificate.

  • GetCertificate: Returns the current TLS certificate.

Additionally, you can use the lib.GenerateSelfSignedCert function to generate a self-signed certificate.

import (
    ...
    "ergo.services/ergo"
    "ergo.services/ergo/gen"
    "ergo.services/ergo/lib"
    ...
)

var (
    Version = gen.Version{
        Name:    "DemoService",
	Release: "1.0",
    }
)

func main() {
    var options gen.NodeOptions
    ...
    cert, err := lib.GenerateSelfSignedCert(Version.String())
    if err != nil {
        panic(err)
    }
    options.CertManager = gen.CreateCertManager(cert)
    ...
    node, err := ergo.StartNode("node@localhost", options)
    if err != nil {
	panic(err)
    }

    node.Wait()
} 

PreviousLoggingNextActor

Last updated 9 months ago

Was this helpful?