You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.go
    path of file: ./repos/magistrala/cmd/certs
    
    the code of the file until where you have to start completion: // Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0

// Package main contains certs main function to start the certs service.
package main

import (
	"context"
	"fmt"
	"log"
	"log/slog"
	"net/url"
	"os"

	chclient "github.com/absmach/callhome/pkg/client"
	"github.com/absmach/magistrala"
	"github.com/absmach/magistrala/certs"
	"github.com/absmach/magistrala/certs/api"
	vault "github.com/absmach/magistrala/certs/pki
    
func newService(authClient magistrala.AuthServiceClient, db *sqlx.DB, tracer trace.Tracer, logger *slog.Logger, cfg config, dbConfig pgclient.Config, pkiAgent vault.Agent) certs.Service {
	database := postgres.NewDatabase(db, dbConfig, tracer)
	certsRepo := certspg.NewRepository(database, logger)
	config := mgsdk.Config{
		ThingsURL: cfg.ThingsURL,
	}
	sdk := mgsdk.NewSDK(config)
	svc := certs.New(authClient, certsRepo, sdk, pkiAgent)
	svc = api.LoggingMiddleware(svc, logger)
	counter, latency := internal.MakeMetrics(svcName, "api")
	svc = api.MetricsMiddleware(svc, counter, latency)
	svc = tracing.New(svc, tracer)

	return svc
}