configurations

package
v0.0.0-...-5cbff6f Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceName    = "personal-data-node"
	ServiceVersion = "v0.0.0"
	StartTimeout   = 5 * time.Minute
)
View Source
var Flags = []cli.Flag{
	&cli.Int64Flag{
		Name:    "pdn-app-id",
		Usage:   "it is application ID",
		Value:   0,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_ID"},
	},
	&cli.Int64Flag{
		Name:    "pdn-app-id-gen-node",
		Usage:   "it is application ID generation node",
		Value:   0,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_ID_GEN_NODE"},
	},
	&cli.StringFlag{
		Name:    "pdn-app-name",
		Usage:   "it is unique application name",
		Value:   "name",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_NAME"},
	},
	&cli.StringFlag{
		Name:    "pdn-app-description",
		Usage:   "it is application description",
		Value:   "it is personal data node",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_DESCRIPTION"},
	},
	&cli.StringFlag{
		Name:    "pdn-app-label",
		Usage:   "it is unique label specific for this personal data node",
		Value:   "pdn",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_LABEL"},
	},
	&cli.Int64Flag{
		Name:    "pdn-app-network-warden-id",
		Usage:   "it is ID of the warden of the network",
		Value:   0,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_NW_ID"},
	},
	&cli.Int64Flag{
		Name:    "pdn-app-accounts-capacity",
		Usage:   "it is the account's capacity of the personal data node",
		Value:   0,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_ACCOUNTS_CAPACITY"},
	},
	&cli.Int64Flag{
		Name:    "pdn-app-crawl-rate-limit-max-requests",
		Usage:   "it is rate limit max crawl requests amount",
		Value:   1000,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_CRAWL_RATE_LIMIT_MAX_REQUESTS"},
	},
	&cli.DurationFlag{
		Name:    "pdn-app-crawl-rate-limit-interval",
		Usage:   "it is rate limit interval for crawl requests",
		Value:   time.Minute,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_CRAWL_RATE_LIMIT_INTERVAL"},
	},
	&cli.Int64Flag{
		Name:    "pdn-app-rate-limit-max-requests",
		Usage:   "it is rate limit max requests amount",
		Value:   1000,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_RATE_LIMIT_MAX_REQUESTS"},
	},
	&cli.DurationFlag{
		Name:    "pdn-app-rate-limit-interval",
		Usage:   "it is rate limit interval",
		Value:   time.Minute,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_APP_RATE_LIMIT_INTERVAL"},
	},
	&cli.BoolFlag{
		Name:    "pdn-logger-production",
		Usage:   "make it true if you need logging on production environment",
		Value:   false,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_LOGGER_PRODUCTION"},
	},
	&cli.StringFlag{
		Name:    "pdn-grpc-host",
		Usage:   "it is gRPC server host",
		Value:   "0.0.0.0",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_GRPC_HOST"},
	},
	&cli.StringFlag{
		Name:    "pdn-grpc-port",
		Usage:   "it is gRPC server port",
		Value:   "8080",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_GRPC_PORT"},
	},
	&cli.StringFlag{
		Name:    "pdn-http-gateway-host",
		Usage:   "it is HTTP gateway host",
		Value:   "0.0.0.0",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_HTTP_GATEWAY_HOST"},
	},
	&cli.StringFlag{
		Name:    "pdn-http-gateway-port",
		Usage:   "it is HTTP gateway port",
		Value:   "9090",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_HTTP_GATEWAY_PORT"},
	},
	&cli.BoolFlag{
		Name:    "pdn-enabled-health-server",
		Usage:   "make it true if you need to enable health server",
		Value:   false,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_ENABLED_HEALTH_SERVER"},
	},
	&cli.StringFlag{
		Name:    "pdn-health-server-host",
		Usage:   "it is health server host",
		Value:   "0.0.0.0",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_HEALTH_SERVER_HOST"},
	},
	&cli.StringFlag{
		Name:    "pdn-health-server-port",
		Usage:   "it is health server port",
		Value:   "10010",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_HEALTH_SERVER_PORT"},
	},
	&cli.StringFlag{
		Name:    "pdn-liveness-gateway-host",
		Usage:   "it is liveness gateway host",
		Value:   "0.0.0.0",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_LIVENESS_GATEWAY_HOST"},
	},
	&cli.StringFlag{
		Name:    "pdn-liveness-gateway-port",
		Usage:   "it is liveness gateway port",
		Value:   "8086",
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_LIVENESS_GATEWAY_PORT"},
	},
	&cli.DurationFlag{
		Name:    "pdn-grpc-max-conn-age",
		Usage:   "it is max age of connection with gRPC server",
		Value:   5 * time.Minute,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_GRPC_MAX_CONNECTION_AGE"},
	},
	&cli.DurationFlag{
		Name:    "pdn-grpc-keep-alive-enforcement-min-time",
		Usage:   "it is minimal time of keep alive enforcement gRPC server",
		Value:   time.Minute,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_GRPC_KEEP_ALIVE_ENFORCEMENT_MIN_TIME"},
	},
	&cli.BoolFlag{
		Name:    "pdn-grpc-keep-alive-enforcement-permit-without-stream",
		Usage:   "",
		Value:   true,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_GRPC_KEEP_ALIVE_ENFORCEMENT_PERMIT_WITHOUT_STREAM"},
	},
	&cli.StringFlag{
		Name:    "pdn-postgres-url",
		Usage:   "it is URL of postgres database connected to the app",
		Value:   `postgresql://ecumenosuser:rootpassword@localhost:5432/ecumenos_personal_data_node_db`,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_POSTGRES_URL"},
	},
	&cli.StringFlag{
		Name:    "pdn-postgres-migrations-path",
		Usage:   "it is path to directory with postgres migrations",
		Value:   `file://cmd/core/pgmigrations`,
		EnvVars: []string{"PERSONAL_DATA_NODE_CORE_POSTGRES_MIGRATIONS_PATH"},
	},
}
View Source
var Module = func(cctx *cli.Context) fx.Option {
	return fx.Options(
		fx.Provide(func() fxConfig {
			return fxConfig{
				App: &toolkitfx.GenericAppConfig{
					ID:          cctx.Int64("pdn-app-id"),
					IDGenNode:   cctx.Int64("pdn-app-id-gen-node"),
					Name:        cctx.String("pdn-app-name"),
					Description: cctx.String("pdn-app-description"),
					RateLimit: &types.RateLimit{
						MaxRequests: cctx.Int64("pdn-app-rate-limit-max-requests"),
						Interval:    cctx.Duration("pdn-app-rate-limit-interval"),
					},
				},
				AppSpecific: &toolkitfx.PersonalDataNodeAppConfig{
					NetworkWardenID:  cctx.Int64("pdn-app-network-warden-id"),
					Label:            cctx.String("pdn-app-label"),
					AccountsCapacity: cctx.Int64("pdn-app-accounts-capacity"),
					CrawlRateLimit: &types.RateLimit{
						MaxRequests: cctx.Int64("pdn-app-crawl-rate-limit-max-requests"),
						Interval:    cctx.Duration("pdn-app-crawl-rate-limit-interval"),
					},
				},
				Logger: &fxlogger.Config{
					Production: cctx.Bool("pdn-logger-production"),
				},
				GRPC: &fxgrpc.Config{
					GRPC: fxgrpc.GRPCConfig{
						Host:                                    cctx.String("pdn-grpc-host"),
						Port:                                    cctx.String("pdn-grpc-port"),
						MaxConnectionAge:                        cctx.Duration("pdn-grpc-max-conn-age"),
						KeepAliveEnforcementMinTime:             cctx.Duration("pdn-grpc-keep-alive-enforcement-min-time"),
						KeepAliveEnforcementPermitWithoutStream: cctx.Bool("pdn-grpc-keep-alive-enforcement-permit-without-stream"),
					},
					Health: fxgrpc.HealthConfig{
						Enabled: cctx.Bool("pdn-enabled-health-server"),
						Host:    cctx.String("pdn-health-server-host"),
						Port:    cctx.String("pdn-health-server-port"),
					},
					HTTPGateway: fxgrpc.HTTPGatewayConfig{
						Host: cctx.String("pdn-http-gateway-host"),
						Port: cctx.String("pdn-http-gateway-port"),
					},
					LivenessGateway: fxgrpc.LivenessGatewayConfig{
						Host: cctx.String("pdn-liveness-gateway-host"),
						Port: cctx.String("pdn-liveness-gateway-port"),
					},
				},
				Postgres: &fxpostgres.Config{
					URL:            cctx.String("pdn-postgres-url"),
					MigrationsPath: cctx.String("pdn-postgres-migrations-path"),
				},
			}
		}),
	)
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳