group and order config items

and fix lint
This commit is contained in:
André Roth
2024-12-02 21:27:38 +01:00
parent 0e0189f0eb
commit 87a36633e9
2 changed files with 79 additions and 62 deletions

View File

@@ -7,10 +7,6 @@
# - published repositories (`rootDir`/public) # - published repositories (`rootDir`/public)
root_dir: ~/.aptly root_dir: ~/.aptly
# Number of attempts to open database if it's locked by other instance
# * -1 (no retry)
database_open_attempts: -1
# Log Level # Log Level
# * debug # * debug
# * info # * info
@@ -23,11 +19,23 @@ log_level: info
# * json # * json
log_format: default log_format: default
# Number of attempts to open database if it's locked by other instance
# * -1 (no retry)
database_open_attempts: -1
# Default Architectures # Default Architectures
# empty list defaults to all available architectures # empty list defaults to all available architectures
architectures: architectures:
# - amd64 # - amd64
# OBSOLETE
# in aptly up to version 1.0.0, package files were stored in internal package pool
# with MD5-dervied path, since 1.1.0 package pool layout was changed;
# if option is enabled, aptly stops checking for legacy paths;
# by default option is enabled for new aptly installations and disabled when
# upgrading from older versions
skip_legacy_pool: true
# Dependency following # Dependency following
####################### #######################
@@ -58,14 +66,6 @@ ppa_distributor_id: ubuntu
# Codename for short PPA url expansion # Codename for short PPA url expansion
ppa_codename: "" ppa_codename: ""
# OBSOLETE
# in aptly up to version 1.0.0, package files were stored in internal package pool
# with MD5-dervied path, since 1.1.0 package pool layout was changed;
# if option is enabled, aptly stops checking for legacy paths;
# by default option is enabled for new aptly installations and disabled when
# upgrading from older versions
skip_legacy_pool: true
# Aptly Server # Aptly Server
############### ###############
@@ -196,11 +196,6 @@ s3_publish_endpoints:
# region: us-east-1 # region: us-east-1
# # Bucket name # # Bucket name
# bucket: test-bucket # bucket: test-bucket
# # Endpoint (optional)
# # When using S3-compatible cloud storage, specify hostname of service endpoint here,
# # region is ignored if endpoint is set (set region to some human-readable name)
# # (should be left blank for real Amazon S3)
# endpoint: ""
# # Prefix (optional) # # Prefix (optional)
# # publishing under specified prefix in the bucket, defaults to # # publishing under specified prefix in the bucket, defaults to
# # no prefix (bucket root) # # no prefix (bucket root)
@@ -217,6 +212,11 @@ s3_publish_endpoints:
# access_key_id: "" # access_key_id: ""
# secret_access_key: "" # secret_access_key: ""
# session_token: "" # session_token: ""
# # Endpoint (optional)
# # When using S3-compatible cloud storage, specify hostname of service endpoint here,
# # region is ignored if endpoint is set (set region to some human-readable name)
# # (should be left blank for real Amazon S3)
# endpoint: ""
# # Storage Class (optional) # # Storage Class (optional)
# # Amazon S3 storage class, defaults to `STANDARD`. Other values # # Amazon S3 storage class, defaults to `STANDARD`. Other values
# # available: `REDUCED_REDUNDANCY` (lower price, lower redundancy) # # available: `REDUCED_REDUNDANCY` (lower price, lower redundancy)

View File

@@ -13,46 +13,63 @@ import (
// ConfigStructure is structure of main configuration // ConfigStructure is structure of main configuration
type ConfigStructure struct { // nolint: maligned type ConfigStructure struct { // nolint: maligned
RootDir string `json:"rootDir" yaml:"root_dir"` // General
DownloadConcurrency int `json:"downloadConcurrency" yaml:"download_concurrency"` RootDir string `json:"rootDir" yaml:"root_dir"`
DownloadLimit int64 `json:"downloadSpeedLimit" yaml:"download_limit"` LogLevel string `json:"logLevel" yaml:"log_level"`
DownloadRetries int `json:"downloadRetries" yaml:"download_retries"` LogFormat string `json:"logFormat" yaml:"log_format"`
Downloader string `json:"downloader" yaml:"downloader"` DatabaseOpenAttempts int `json:"databaseOpenAttempts" yaml:"database_open_attempts"`
DatabaseOpenAttempts int `json:"databaseOpenAttempts" yaml:"database_open_attempts"` Architectures []string `json:"architectures" yaml:"architectures"`
Architectures []string `json:"architectures" yaml:"architectures"` SkipLegacyPool bool `json:"skipLegacyPool" yaml:"skip_legacy_pool"` // OBSOLETE
DepFollowSuggests bool `json:"dependencyFollowSuggests" yaml:"dep_follow_suggests"`
DepFollowRecommends bool `json:"dependencyFollowRecommends" yaml:"dep_follow_recommends"` // Dependency following
DepFollowAllVariants bool `json:"dependencyFollowAllVariants" yaml:"dep_follow_all_variants"` DepFollowSuggests bool `json:"dependencyFollowSuggests" yaml:"dep_follow_suggests"`
DepFollowSource bool `json:"dependencyFollowSource" yaml:"dep_follow_source"` DepFollowRecommends bool `json:"dependencyFollowRecommends" yaml:"dep_follow_recommends"`
DepVerboseResolve bool `json:"dependencyVerboseResolve" yaml:"dep_verboseresolve"` DepFollowAllVariants bool `json:"dependencyFollowAllVariants" yaml:"dep_follow_all_variants"`
GpgDisableSign bool `json:"gpgDisableSign" yaml:"gpg_disable_sign"` DepFollowSource bool `json:"dependencyFollowSource" yaml:"dep_follow_source"`
GpgDisableVerify bool `json:"gpgDisableVerify" yaml:"gpg_disable_verify"` DepVerboseResolve bool `json:"dependencyVerboseResolve" yaml:"dep_verboseresolve"`
GpgProvider string `json:"gpgProvider" yaml:"gpg_provider"`
DownloadSourcePackages bool `json:"downloadSourcePackages" yaml:"download_sourcepackages"` // PPA
PackagePoolStorage PackagePoolStorage `json:"packagePoolStorage" yaml:"packagepool_storage"` PpaDistributorID string `json:"ppaDistributorID" yaml:"ppa_distributor_id"`
SkipLegacyPool bool `json:"skipLegacyPool" yaml:"skip_legacy_pool"` PpaCodename string `json:"ppaCodename" yaml:"ppa_codename"`
PpaDistributorID string `json:"ppaDistributorID" yaml:"ppa_distributor_id"`
PpaCodename string `json:"ppaCodename" yaml:"ppa_codename"` // Server
SkipContentsPublishing bool `json:"skipContentsPublishing" yaml:"skip_contents_publishing"` ServeInAPIMode bool `json:"serveInAPIMode" yaml:"serve_in_api_mode"`
SkipBz2Publishing bool `json:"skipBz2Publishing" yaml:"skip_bz2_publishing"` EnableMetricsEndpoint bool `json:"enableMetricsEndpoint" yaml:"enable_metrics_endpoint"`
EnableSwaggerEndpoint bool `json:"enableSwaggerEndpoint" yaml:"enable_swagger_endpoint"`
AsyncAPI bool `json:"AsyncAPI" yaml:"async_api"` // OBSOLETE
// Database
DatabaseBackend DBConfig `json:"databaseBackend" yaml:"database_backend"`
// Mirroring
Downloader string `json:"downloader" yaml:"downloader"`
DownloadConcurrency int `json:"downloadConcurrency" yaml:"download_concurrency"`
DownloadLimit int64 `json:"downloadSpeedLimit" yaml:"download_limit"`
DownloadRetries int `json:"downloadRetries" yaml:"download_retries"`
DownloadSourcePackages bool `json:"downloadSourcePackages" yaml:"download_sourcepackages"`
// Signing
GpgProvider string `json:"gpgProvider" yaml:"gpg_provider"`
GpgDisableSign bool `json:"gpgDisableSign" yaml:"gpg_disable_sign"`
GpgDisableVerify bool `json:"gpgDisableVerify" yaml:"gpg_disable_verify"`
// Publishing
SkipContentsPublishing bool `json:"skipContentsPublishing" yaml:"skip_contents_publishing"`
SkipBz2Publishing bool `json:"skipBz2Publishing" yaml:"skip_bz2_publishing"`
// Storage
FileSystemPublishRoots map[string]FileSystemPublishRoot `json:"FileSystemPublishEndpoints" yaml:"filesystem_publish_endpoints"` FileSystemPublishRoots map[string]FileSystemPublishRoot `json:"FileSystemPublishEndpoints" yaml:"filesystem_publish_endpoints"`
S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints" yaml:"s3_publish_endpoints"` S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints" yaml:"s3_publish_endpoints"`
SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints" yaml:"swift_publish_endpoints"` SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints" yaml:"swift_publish_endpoints"`
AzurePublishRoots map[string]AzureEndpoint `json:"AzurePublishEndpoints" yaml:"azure_publish_endpoints"` AzurePublishRoots map[string]AzureEndpoint `json:"AzurePublishEndpoints" yaml:"azure_publish_endpoints"`
AsyncAPI bool `json:"AsyncAPI" yaml:"async_api"` PackagePoolStorage PackagePoolStorage `json:"packagePoolStorage" yaml:"packagepool_storage"`
EnableMetricsEndpoint bool `json:"enableMetricsEndpoint" yaml:"enable_metrics_endpoint"`
LogLevel string `json:"logLevel" yaml:"log_level"`
LogFormat string `json:"logFormat" yaml:"log_format"`
ServeInAPIMode bool `json:"serveInAPIMode" yaml:"serve_in_api_mode"`
DatabaseBackend DBConfig `json:"databaseBackend" yaml:"database_backend"`
EnableSwaggerEndpoint bool `json:"enableSwaggerEndpoint" yaml:"enable_swagger_endpoint"`
} }
// DBConfig // DBConfig
type DBConfig struct { type DBConfig struct {
Type string `json:"type" yaml:"type"` Type string `json:"type" yaml:"type"`
URL string `json:"url" yaml:"url"`
DbPath string `json:"dbPath" yaml:"db_path"` DbPath string `json:"dbPath" yaml:"db_path"`
URL string `json:"url" yaml:"url"`
} }
type LocalPoolStorage struct { type LocalPoolStorage struct {
@@ -125,20 +142,20 @@ func (pool *PackagePoolStorage) MarshalJSON() ([]byte, error) {
func (pool PackagePoolStorage) MarshalYAML() (interface{}, error) { func (pool PackagePoolStorage) MarshalYAML() (interface{}, error) {
var wrapper struct { var wrapper struct {
Type string `yaml:"type,omitempty"` Type string `yaml:"type,omitempty"`
*LocalPoolStorage `yaml:",inline"` *LocalPoolStorage `yaml:",inline"`
*AzureEndpoint `yaml:",inline"` *AzureEndpoint `yaml:",inline"`
} }
if pool.Azure != nil { if pool.Azure != nil {
wrapper.Type = "azure" wrapper.Type = "azure"
wrapper.AzureEndpoint = pool.Azure wrapper.AzureEndpoint = pool.Azure
} else if pool.Local.Path != "" { } else if pool.Local.Path != "" {
wrapper.Type = "local" wrapper.Type = "local"
wrapper.LocalPoolStorage = pool.Local wrapper.LocalPoolStorage = pool.Local
} }
return wrapper, nil return wrapper, nil
} }
// FileSystemPublishRoot describes single filesystem publishing entry point // FileSystemPublishRoot describes single filesystem publishing entry point
@@ -152,12 +169,12 @@ type FileSystemPublishRoot struct {
type S3PublishRoot struct { type S3PublishRoot struct {
Region string `json:"region" yaml:"region"` Region string `json:"region" yaml:"region"`
Bucket string `json:"bucket" yaml:"bucket"` Bucket string `json:"bucket" yaml:"bucket"`
Endpoint string `json:"endpoint" yaml:"endpoint"` Prefix string `json:"prefix" yaml:"prefix"`
ACL string `json:"acl" yaml:"acl"`
AccessKeyID string `json:"awsAccessKeyID" yaml:"access_key_id"` AccessKeyID string `json:"awsAccessKeyID" yaml:"access_key_id"`
SecretAccessKey string `json:"awsSecretAccessKey" yaml:"secret_access_key"` SecretAccessKey string `json:"awsSecretAccessKey" yaml:"secret_access_key"`
SessionToken string `json:"awsSessionToken" yaml:"session_token"` SessionToken string `json:"awsSessionToken" yaml:"session_token"`
Prefix string `json:"prefix" yaml:"prefix"` Endpoint string `json:"endpoint" yaml:"endpoint"`
ACL string `json:"acl" yaml:"acl"`
StorageClass string `json:"storageClass" yaml:"storage_class"` StorageClass string `json:"storageClass" yaml:"storage_class"`
EncryptionMethod string `json:"encryptionMethod" yaml:"encryption_method"` EncryptionMethod string `json:"encryptionMethod" yaml:"encryption_method"`
PlusWorkaround bool `json:"plusWorkaround" yaml:"plus_workaround"` PlusWorkaround bool `json:"plusWorkaround" yaml:"plus_workaround"`
@@ -169,25 +186,25 @@ type S3PublishRoot struct {
// SwiftPublishRoot describes single OpenStack Swift publishing entry point // SwiftPublishRoot describes single OpenStack Swift publishing entry point
type SwiftPublishRoot struct { type SwiftPublishRoot struct {
Container string `json:"container" yaml:"container"`
Prefix string `json:"prefix" yaml:"prefix"`
UserName string `json:"osname" yaml:"username"` UserName string `json:"osname" yaml:"username"`
Password string `json:"password" yaml:"password"` Password string `json:"password" yaml:"password"`
AuthURL string `json:"authurl" yaml:"auth_url"`
Tenant string `json:"tenant" yaml:"tenant"` Tenant string `json:"tenant" yaml:"tenant"`
TenantID string `json:"tenantid" yaml:"tenant_id"` TenantID string `json:"tenantid" yaml:"tenant_id"`
Domain string `json:"domain" yaml:"domain"` Domain string `json:"domain" yaml:"domain"`
DomainID string `json:"domainid" yaml:"domain_id"` DomainID string `json:"domainid" yaml:"domain_id"`
TenantDomain string `json:"tenantdomain" yaml:"tenant_domain"` TenantDomain string `json:"tenantdomain" yaml:"tenant_domain"`
TenantDomainID string `json:"tenantdomainid" yaml:"tenant_domain_id"` TenantDomainID string `json:"tenantdomainid" yaml:"tenant_domain_id"`
Prefix string `json:"prefix" yaml:"prefix"` AuthURL string `json:"authurl" yaml:"auth_url"`
Container string `json:"container" yaml:"container"`
} }
// AzureEndpoint describes single Azure publishing entry point // AzureEndpoint describes single Azure publishing entry point
type AzureEndpoint struct { type AzureEndpoint struct {
AccountName string `json:"accountName" yaml:"account_name"`
AccountKey string `json:"accountKey" yaml:"account_key"`
Container string `json:"container" yaml:"container"` Container string `json:"container" yaml:"container"`
Prefix string `json:"prefix" yaml:"prefix"` Prefix string `json:"prefix" yaml:"prefix"`
AccountName string `json:"accountName" yaml:"account_name"`
AccountKey string `json:"accountKey" yaml:"account_key"`
Endpoint string `json:"endpoint" yaml:"endpoint"` Endpoint string `json:"endpoint" yaml:"endpoint"`
} }