Treats

Treats

  • Getting Started

›Main Concepts

Getting Started

  • Installation

Tutorial

  • 01. Creating Your First Page
  • 02. Using Redux
  • 03. Using GraphQL
  • 04. Fetch Data for SSR
  • 05. Adding Addons

Main Concepts

  • Overview
  • Routing
  • Localization
  • Code-splitting
  • Redux
  • GraphQL Client
  • Middlewares
  • Helpers
  • Server-side Events
  • Server-side Template
  • Server-side Rendering
  • Custom Server App
  • Custom Client Initialization
  • Custom React App
  • Runtime Config
  • Build Config
  • Environment Variables
  • Code Generator
  • Scripts
  • Addons
  • Typescript
  • Workbox

API Reference

  • Overview
  • Filesystem Hooks
  • Components
  • Server
  • Client
  • Router
  • Intl
  • Locale Data
  • Helmet
  • Redux
  • Graphql

Authoring Addons

  • Overview
  • Helpers
  • Middlewares
  • Generators
  • Wrapping Up

Addons

  • Treats Addons List

Contributing

  • How To Contribute

FAQ

  • FAQs

Runtime Config

Runtime config can be specified for your server app. Runtime config can be handy to store configs that can be changed frequently so you didn't need to deploy everytime you want to change configs. Runtime configs are stored in JSON format, for example:

// treats.runtime-config.json
{
    "locale": {
        "defaultLang": "id"
    },
    "helper": {
        "redis": {
            "my_redis": {
                "host": "my-redis",
                "port": "6379"
            }
        }
    }
}

Treats Server will look at <PROJECT_DIRECTORY>/treats.runtime-config.json by default for any runtime configs. If you need to change this behavior, you can supply TREATS_CONFIG_DIR environment variable, or if you use custom server app, you can pass configDir on envVars field on configuration object:

// src/_server/index.js
import initServer from "@treats/server";

const app = initServer({
    envVars: {
        configDir: "/etc/my-app/config.json"
    }
});

export default app;
← Custom React AppBuild Config →
Tokopedia Open Source
Copyright © 2019 Tokopedia OSS