Categorygithub.com/JenswBE/go-commerce
repositorypackage
1.1.0
Repository: https://github.com/jenswbe/go-commerce.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

GitHub Docker Pulls

GoCommerce

KISS backend for an e-commerce

Links

Configuration

GoCommerce can be configured in 2 ways:

  1. Create a file called config.yml in the same folder or the parent folder of the binary. See config.yml for an example.
  2. Set environment variables

If both are defined, the environment variables take precedence.

Config keyEnv variableDescriptionDefault value
Authentication.TypeAUTH_TYPESwitch between OIDC and NONE (latter should only be used for testing)OIDC
Authentication.OIDC.IssuerURLAUTH_OIDC_ISSUER_URLURL to OpenID Configuration Issuer (without .well-known/openid-configuration)
Authentication.OIDC.ClientIDAUTH_OIDC_CLIENT_IDClient ID for OIDC
Authentication.OIDC.ClientSecretAUTH_OIDC_CLIENT_SECRETClient secret for OIDC
Authentication.SessionAuthKeyAUTH_SESSION_AUTH_KEYAuthentication key for session tokens. Mandatory and must be a base64 encoded string of 64 bytes.
Can be generated using openssl rand -base64 64 | paste --delimiters '' --serial
Authentication.SessionEncKeyAUTH_SESSION_ENC_KEYEncryption key for session tokens. Mandatory and must be a base64 encoded string of 32 bytes.
Can be generated using openssl rand -base64 32 | paste --delimiters '' --serial
Database.Default.HostDATABASE_DEFAULT_HOSTHostname of the default Postgres datatabase
Database.Default.PortDATABASE_DEFAULT_PORTPort of the default Postgres datatabase5432
Database.Default.UserDATABASE_DEFAULT_USERUsername for the default Postgres datatabase
Database.Default.PasswordDATABASE_DEFAULT_PASSWORDPassword for the default Postgres datatabase
Database.Default.DatabaseDATABASE_DEFAULT_DATABASEDatabase name for default the Postgres datatabase
Database.Content.HostDATABASE_CONTENT_HOSTOverride the default hostname for the content Postgres datatabase
Database.Content.PortDATABASE_CONTENT_PORTOverride the default port for the content Postgres datatabase
Database.Content.UserDATABASE_CONTENT_USEROverride the default user for the content Postgres datatabase
Database.Content.PasswordDATABASE_CONTENT_PASSWORDOverride the default password for the content Postgres datatabase
Database.Content.DatabaseDATABASE_CONTENT_DATABASEOverride the default database for the content Postgres datatabase
Database.Product.HostDATABASE_PRODUCT_HOSTOverride the default hostname for the product Postgres datatabase
Database.Product.PortDATABASE_PRODUCT_PORTOverride the default port for the product Postgres datatabase
Database.Product.UserDATABASE_PRODUCT_USEROverride the default user for the product Postgres datatabase
Database.Product.PasswordDATABASE_PRODUCT_PASSWORDOverride the default password for the product Postgres datatabase
Database.Product.DatabaseDATABASE_PRODUCT_DATABASEOverride the default database for the product Postgres datatabase
Features.StartpageFeatureFEATURES_STARTPAGE_FEATUREFeature which should be shown as startpage. See below config keys for supported features.Products
Features.Categories.EnabledFEATURES_CATEGORIES_ENABLEDSupport for categories is enabledtrue
Features.Manufacturers.EnabledFEATURES_MANUFACTURERS_ENABLEDSupport for manufacturers is enabledtrue
Features.Products.EnabledFEATURES_PRODUCTS_ENABLEDSupport for products is enabledtrue
Features.Products.PublicURLTemplateFEATURES_PRODUCTS_PUBLIC_URL_TEMPLATEOptional template for showing link to product page on public site. Button is omitted in
list if not provided. String is parsed into a Go HTML template. Product is available as ..
Features.Products.ShortDescriptionOnlyFEATURES_PRODUCTS_SHORT_DESCRIPTION_ONLYSupport for long descriptions for products is disabledtrue
Features.Services.EnabledFEATURES_SERVICES_ENABLEDSupport for services is enabledtrue
Features.Content.EnabledFEATURES_CONTENT_ENABLEDSupport for content is enabledtrue
Features.Content.ListFEATURES_CONTENT_LISTList of content. New content is automatically added to the DB. Missing content is not removed from the DB.
Config: Object with fields Name and ContentType
Env: List of format Name:ContentType
Features.Events.EnabledFEATURES_EVENTS_ENABLEDSupport for events is enabledtrue
Features.Events.WholeDaysOnlyFEATURES_EVENTS_WHOLE_DAYS_ONLYOnly events with full days (no time) are supportedtrue
ImageProxy.BaseURLIMAGE_PROXY_BASE_URLBase URL of your Imgproxy instance/images/
ImageProxy.KeyIMAGE_PROXY_KEYSigning key for Imgproxy
ImageProxy.SaltIMAGE_PROXY_SALTSalt for Imgproxy
ImageProxy.AllowedConfigsIMAGE_PROXY_ALLOWED_CONFIGSComma-separated list of allowed image configs in format width:height:resizingType.
Example 100:100:FILL,300:200:FIT. Use * if not limiting the configs.
Server.DebugGOCOM_DEBUGSet to true to enable debug logging and put API framework in debug mode.false
Server.PortGOCOM_PORTHTTP port on which the GoCommerce API listens8080
Server.TrustedProxiesGOCOM_TRUSTED_PROXIESIP's of proxies trusted by GoCommerce. Header X-Forwarded-For is only considered for these hosts.172.16.0.0/16
Storage.Images.TypeSTORAGE_IMAGES_TYPEType of storage used for storing images. Currently only fs is supported.fs
Storage.Images.PathSTORAGE_IMAGES_PATHPath for storing images./files/images

Running locally

podman compose up -d
go run . # Or: reflex -R files/images/write_test.tmp -vs go run .
podman compose down

Run end-to-end tests

# For Docker Compose use: "-f docker-compose.e2e.yml -f docker-compose.e2e.docker.yml"
podman compose -f docker-compose.e2e.yml up -d
go test --tags e2e ./...
podman compose -f docker-compose.e2e.yml down