component

package
v0.1.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package component provides JWT token lifecycle integration for bootstrap.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component

func Component() bootstrap.IComponent

Component wraps loadFromEnv as a bootstrap.IComponent.

Close is a no-op: the token package holds no resources that require release.

Register this component after env/log and before gin, alongside auth/component if the service also uses Casbin authorization:

Add(envComp.Component("config/app.toml")).
Add(logComp.Component()).
AddParallel(dbComp.Component()).
PreReady(initServices).
Add(tokenComp.Component()).
Add(ginComp.Component(func(r *gin.Engine) { ... })).
Example

ExampleComponent shows how token.Component() is registered in a bootstrap chain. Init() reads jwt.issuer/jwt.access.secretcode/jwt.refresh.secretcode from env.

package main

import (
	"fmt"

	tokenComp "github.com/phcp-tech/common-library-golang/token/component"
)

func main() {
	c := tokenComp.Component()
	fmt.Println(c != nil)
	fmt.Println(c.Name())
}
Output:
true
token

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL