forgejo

package module
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAdminCredentials

func WithAdminCredentials(username, password, email string) testcontainers.CustomizeRequestOption

WithAdminCredentials sets the admin username, password, and email for the Forgejo instance. These credentials are used to create an admin user after the container is ready.

func WithConfig

func WithConfig(section, key, value string) testcontainers.CustomizeRequestOption

WithConfig sets a Forgejo configuration value using the FORGEJO__section__key environment variable format. See https://forgejo.org/docs/latest/admin/config-cheat-sheet/ for available options.

Types

type Container

type Container struct {
	testcontainers.Container
	// contains filtered or unexported fields
}

Container represents the Forgejo container type used in the module

func Run

Run creates an instance of the Forgejo container type

Example
// runForgejoContainer {
ctx := context.Background()

forgejoContainer, err := forgejo.Run(ctx, "codeberg.org/forgejo/forgejo:11")
defer func() {
	if err := testcontainers.TerminateContainer(forgejoContainer); err != nil {
		log.Printf("failed to terminate container: %s", err)
	}
}()
if err != nil {
	log.Printf("failed to start container: %s", err)
	return
}
// }

state, err := forgejoContainer.State(ctx)
if err != nil {
	log.Printf("failed to get container state: %s", err)
	return
}

fmt.Println(state.Running)
Output:

true

func (*Container) AdminPassword

func (c *Container) AdminPassword() string

AdminPassword returns the admin password for the Forgejo instance.

func (*Container) AdminUsername

func (c *Container) AdminUsername() string

AdminUsername returns the admin username for the Forgejo instance.

func (*Container) ConnectionString

func (c *Container) ConnectionString(ctx context.Context) (string, error)

ConnectionString returns the HTTP URL for the Forgejo instance

func (*Container) SSHConnectionString

func (c *Container) SSHConnectionString(ctx context.Context) (string, error)

SSHConnectionString returns the SSH endpoint for Git operations

Jump to

Keyboard shortcuts

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