All files / src/constants Defaults.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67                                      13x                                                                                              
import { SystemConfiguration } from '@/types/SystemConfiguration'
 
/**
 * @constant
 *
 * Default settings for the kernel.
 *
 * @remarks
 * What an application logs and protects when it overrides nothing. Anything a
 * platform resource settles — a binding name, a TTL, a model, a connection
 * string — belongs to an adapter package instead, and the application merges
 * both halves when it calls {@link configure}.
 *
 * Nothing here is application-specific. Anything that is belongs in an override.
 *
 * @author Bayu Dwiyan Satria
 * @version 1.0.0
 * @since 1.0.0
 */
export const systemDefaults: SystemConfiguration = {
  /**
   * Logging — structured lines to the runtime's log stream at `info` and above.
   * `LOG_LEVEL` in the environment overrides this per deployment.
   *
   * `service` has no default, and that is not the same as it being unused.
   * Every line carries one; it comes from `SERVICE_NAME` in the environment,
   * beside the deployment's own name, so a rename cannot leave it behind. A
   * default here would be a name to inherit and forget — which is exactly how
   * a Worker came to spend production calling itself `cloudflare-boilerplate`.
   *
   * An application with no environment to read sets `logging.service` in an
   * override instead, and one whose stream carries nothing else can leave both
   * unset.
   */
  logging: {
    level: 'info'
  },
 
  /**
   * Outbound delivery — ten seconds an attempt, two retries, and a backoff
   * doubling from a quarter of a second. Worst case is a little over thirty
   * seconds, so `timeoutMs` is the one to tighten when callers are less patient
   * than that.
   *
   * `userAgent` is a placeholder, like `logging.service` above. Override it, or
   * the far end's access log says nothing about who is calling.
   */
  delivery: {
    timeoutMs: 10000,
    retries: 2,
    retryBackoffMs: 250,
    userAgent: 'app'
  },
 
  /**
   * Security — API-key authentication on `/api/v1/*`, with the documentation
   * routes left public. Nothing is exempted and every origin is allowed, so a
   * project opts into both by naming them; see `SecuritySettings`.
   */
  security: {
    urlPattern: '/api/v1/*',
    publicRoutes: ['/swagger-ui/*', '/v3/api-docs/*'],
    excludedRoutes: [],
    allowedOrigins: []
  }
}