config

package
v0.0.0-...-9debc38 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 11 Imported by: 55

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNeo4jDriver

func NewNeo4jDriver(cfg Neo4jConfig) (neo4j.DriverWithContext, error)

func NewPostgresDBConn

func NewPostgresDBConn(host, port, user, password, db, logLevel string, maxConn, maxIdleConn, connMaxLifetime int) (*sql.DB, *gorm.DB, error)

Types

type AiAPIConfig

type AiAPIConfig struct {
	Url              string `env:"AI_API_PATH"`
	ApiKey           string `env:"AI_API_KEY"`
	AnthropicPrompts AnthropicPrompts
}

type AnthropicConfig

type AnthropicConfig struct {
	ApiPath string `env:"ANTHROPIC_API_PATH,required" envDefault:"https://api.anthropic.com/v1/messages"`
	ApiKey  string `env:"ANTHROPIC_API_KEY,required" envDefault:""`
}

type AnthropicPrompts

type AnthropicPrompts struct {
	IndustryLookupPrompt1    string `` /* 2050-byte string literal not displayed */
	IndustryLookupPrompt2    string `` /* 1839-byte string literal not displayed */
	EmailSummaryPrompt       string `env:"ANTHROPIC_EMAIL_SUMMARY_PROMPT,required" envDefault:"Make a 120 characters summary for this html email: %v"`
	EmailActionsItemsPrompt  string `` /* 283-byte string literal not displayed */
	LocationEnrichmentPrompt string `` /* 996-byte string literal not displayed */
}

type AzureOAuthConfig

type AzureOAuthConfig struct {
	ClientId     string `env:"AZURE_OAUTH_CLIENT_ID" envDefault:""`
	ClientSecret string `env:"AZURE_OAUTH_CLIENT_SECRET" envDefault:""`
}

type CloudflareConfig

type CloudflareConfig struct {
	Url    string `env:"CLOUDFLARE_URL" envDefault:"https://api.cloudflare.com/client/v4" validate:"required"`
	ApiKey string `env:"CLOUDFLARE_API_KEY" `
	Email  string `env:"CLOUDFLARE_API_EMAIL"`
}

type EnrichmentAPIConfig

type EnrichmentAPIConfig struct {
	Url    string `env:"ENRICHMENT_API_URL"`
	ApiKey string `env:"ENRICHMENT_API_KEY"`
}

type ExternalServices

type ExternalServices struct {
	AnthropicConfig  AnthropicConfig
	CloudflareConfig CloudflareConfig
	NamecheapConfig  NamecheapConfig
	OpenSRSConfig    OpenSRSConfig
	PostmarkConfig   PostmarkConfig
	StripeConfig     StripeConfig
}

type GlobalConfig

type GlobalConfig struct {
	PostgresConfig      *PostgresConfig
	PostgresAsyncConfig *PostgresAsyncConfig
	Neo4jConfig         *Neo4jConfig
	GoogleOAuthConfig   *GoogleOAuthConfig
	AzureOAuthConfig    *AzureOAuthConfig
	GrpcClientConfig    *GrpcClientConfig
	TemporalConfig      *TemporalConfig
	RabbitMQConfig      *RabbitMQConfig
	NovuConfig          *NovuConfig

	// Customer OS
	InternalServices InternalServices
	ExternalServices ExternalServices
}

type GoogleOAuthConfig

type GoogleOAuthConfig struct {
	ClientId     string `env:"GOOGLE_OAUTH_CLIENT_ID" envDefault:""`
	ClientSecret string `env:"GOOGLE_OAUTH_CLIENT_SECRET" envDefault:""`
}

type GrpcClientConfig

type GrpcClientConfig struct {
	EventsProcessingPlatformEnabled     bool   `env:"EVENTS_PROCESSING_PLATFORM_ENABLED" envDefault:"true"`
	EventsProcessingPlatformUrl         string `env:"EVENTS_PROCESSING_PLATFORM_URL" validate:"required"`
	EventsProcessingPlatformApiKey      string `env:"EVENTS_PROCESSING_PLATFORM_API_KEY" validate:"required"`
	EventsProcessingPlatformServername  string `env:"EVENTS_PROCESSING_PLATFORM_SERVER_NAME" envDefault:""`
	EventsProcessingPlatformCertificate string `env:"EVENTS_PROCESSING_PLATFORM_CERTIFICATE" envDefault:""`
}

type InternalServices

type InternalServices struct {
	UserAdminApiPublicPath string `env:"USER_ADMIN_API_PUBLIC_PATH,required" envDefault:"http://localhost:4001"`
	EnrichmentApiConfig    EnrichmentAPIConfig
	AiApiConfig            AiAPIConfig
	ValidationApiConfig    ValidationAPIConfig
}

type NamecheapConfig

type NamecheapConfig struct {
	Url                   string  `env:"NAMECHEAP_URL" envDefault:"https://api.namecheap.com/xml.response" validate:"required"`
	ApiKey                string  `env:"NAMECHEAP_API_KEY" validate:"required"`
	ApiUser               string  `env:"NAMECHEAP_API_USER" validate:"required"`
	ApiUsername           string  `env:"NAMECHEAP_API_USERNAME" validate:"required"`
	ApiClientIp           string  `env:"NAMECHEAP_API_CLIENT_IP" validate:"required"`
	MaxPrice              float64 `env:"NAMECHEAP_MAX_PRICE" envDefault:"20.0" validate:"required"`
	Years                 int     `env:"NAMECHEAP_YEARS" envDefault:"1" validate:"required"`
	RegistrantFirstName   string  `env:"NAMECHEAP_REGISTRANT_FIRST_NAME" validate:"required"`
	RegistrantLastName    string  `env:"NAMECHEAP_REGISTRANT_LAST_NAME" validate:"required"`
	RegistrantCompanyName string  `env:"NAMECHEAP_REGISTRANT_COMPANY_NAME" validate:"required"`
	RegistrantJobTitle    string  `env:"NAMECHEAP_REGISTRANT_JOB_TITLE" validate:"required"`
	RegistrantAddress1    string  `env:"NAMECHEAP_REGISTRANT_ADDRESS1" validate:"required"`
	RegistrantCity        string  `env:"NAMECHEAP_REGISTRANT_CITY" validate:"required"`
	RegistrantState       string  `env:"NAMECHEAP_REGISTRANT_STATE" validate:"required"`
	RegistrantZIP         string  `env:"NAMECHEAP_REGISTRANT_ZIP" validate:"required"`
	RegistrantCountry     string  `env:"NAMECHEAP_REGISTRANT_COUNTRY" validate:"required"`
	RegistrantPhoneNumber string  `env:"NAMECHEAP_REGISTRANT_PHONE_NUMBER" validate:"required"`
	RegistrantEmail       string  `env:"NAMECHEAP_REGISTRANT_EMAIL" validate:"required"`
}

type Neo4jConfig

type Neo4jConfig struct {
	Target                          string `env:"NEO4J_TARGET,required"`
	User                            string `env:"NEO4J_AUTH_USER,required,unset"`
	Pwd                             string `env:"NEO4J_AUTH_PWD,required,unset"`
	Realm                           string `env:"NEO4J_AUTH_REALM"`
	MaxConnectionPoolSize           int    `env:"NEO4J_MAX_CONN_POOL_SIZE" envDefault:"100"`
	SocketConnectTimeout            int    `env:"NEO4J_SOCKET_CONN_TIMEOUT_SEC" envDefault:"5"`
	SocketKeepalive                 bool   `env:"NEO4J_SOCKET_KEEP_ALIVE" envDefault:"true"`
	ConnectionAcquisitionTimeoutSec int    `env:"NEO4J_CONN_ACQUISITION_TIMEOUT_SEC" envDefault:"60"`
	LogLevel                        string `env:"NEO4J_LOG_LEVEL" envDefault:"WARNING"`
	Database                        string `env:"NEO4J_DATABASE" envDefault:"neo4j"`
}

type NovuConfig

type NovuConfig struct {
	FronteraUrl string `env:"FRONTERA_URL" envDefault:"N/A"`
	ApiKey      string `env:"NOVU_API_KEY" envDefault:"N/A"`
}

type OpenSRSConfig

type OpenSRSConfig struct {
	Url      string `env:"OPENSRS_URL" envDefault:"https://admin.a.hostedemail.com"`
	ApiKey   string `env:"OPENSRS_API_KEY"`
	Username string `env:"OPENSRS_API_USERNAME"`
}

type PostgresAsyncConfig

type PostgresAsyncConfig struct {
	Host            string `env:"POSTGRES_ASYNC_HOST,required"`
	Port            string `env:"POSTGRES_ASYNC_PORT,required"`
	User            string `env:"POSTGRES_ASYNC_USER,required,unset"`
	Db              string `env:"POSTGRES_ASYNC_DB,required"`
	Password        string `env:"POSTGRES_ASYNC_PASSWORD,required,unset"`
	MaxConn         int    `env:"POSTGRES_ASYNC_DB_MAX_CONN"`
	MaxIdleConn     int    `env:"POSTGRES_ASYNC_DB_MAX_IDLE_CONN"`
	ConnMaxLifetime int    `env:"POSTGRES_ASYNC_DB_CONN_MAX_LIFETIME"`
	LogLevel        string `env:"POSTGRES_LOG_LEVEL" envDefault:"WARN"`
}

type PostgresConfig

type PostgresConfig struct {
	Host            string `env:"POSTGRES_HOST,required"`
	Port            string `env:"POSTGRES_PORT,required"`
	User            string `env:"POSTGRES_USER,required,unset"`
	Db              string `env:"POSTGRES_DB,required"`
	Password        string `env:"POSTGRES_PASSWORD,required,unset"`
	MaxConn         int    `env:"POSTGRES_DB_MAX_CONN"`
	MaxIdleConn     int    `env:"POSTGRES_DB_MAX_IDLE_CONN"`
	ConnMaxLifetime int    `env:"POSTGRES_DB_CONN_MAX_LIFETIME"`
	LogLevel        string `env:"POSTGRES_LOG_LEVEL" envDefault:"WARN"`
}

type PostgresDB

type PostgresDB struct {
	SqlDB  *sql.DB
	GormDB *gorm.DB

	AsyncSqlDB  *sql.DB
	AsyncGormDB *gorm.DB
}

func InitPostgres

func InitPostgres(cfg *GlobalConfig) (*PostgresDB, error)

func (*PostgresDB) Close

func (db *PostgresDB) Close()

type PostmarkConfig

type PostmarkConfig struct {
	Url                         string `env:"POSTMARK_URL" envDefault:"https://api.postmarkapp.com"`
	AccountApiKey               string `env:"POSTMARK_ACCOUNT_API_KEY"`
	DefaultInboundStreamWebhook string `env:"POSTMARK_DEFAULT_INBOUND_STREAM_WEBHOOK"`
}

type RabbitMQConfig

type RabbitMQConfig struct {
	Url string `env:"RABBITMQ_URL" envDefault:"amqp://guest:guest@localhost:5672"`
}

type StripeConfig

type StripeConfig struct {
	ApiKey string `env:"STRIPE_API_KEY" envDefault:"N/A"`
}

type TemporalConfig

type TemporalConfig struct {
	HostPort            string `env:"TEMPORAL_HOSTPORT" envDefault:"openline-dev-temporal-frontend.openline.svc.cluster.local:7233"`
	Namespace           string `env:"TEMPORAL_NAMESPACE" envDefault:"default"`
	RunWorker           bool   `env:"TEMPORAL_RUN_WORKER" envDefault:"false"`
	NotifyOnFailure     bool   `env:"TEMPORAL_NOTIFY_ON_FAILURE" envDefault:"true"`
	NotifyAfterAttempts int32  `env:"TEMPORAL_NOTIFY_AFTER_ATTEMPTS" envDefault:"7"`
}

type ValidationAPIConfig

type ValidationAPIConfig struct {
	Url    string `env:"VALIDATION_API_URL"`
	ApiKey string `env:"VALIDATION_API_KEY"`
}

Jump to

Keyboard shortcuts

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