import asyncio
import time
from dataclasses import dataclass, field
@dataclass
const rawOrigins = process.env.ALLOWED_ORIGINS ?? "";
export const allowedOrigins = new Set(
rawOrigins
.split(",")
.map((o) => o.trim())
class TokenBucket {
constructor(capacity, refillPerSecond) {
this.capacity = capacity;
this.refillPerMs = refillPerSecond / 1000;
this.tokens = capacity;
this.lastRefill = Date.now();
package middleware
import (
"net/http"
"go.uber.org/zap"
require 'sinatra/base'
require 'json'
class HealthApp < Sinatra::Base
configure do
set :dump_errors, true
package middleware
import (
"log"
"net/http"
"runtime/debug"
import threading
from contextlib import contextmanager
_state = threading.local()
package session
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
class Problem
DEFAULT_TYPE = "https://api.example.com/problems/about:blank".freeze
attr_reader :type, :title, :status, :detail, :instance, :extensions
def initialize(status:, title:, detail: nil, type: nil, instance: nil, extensions: {})
const jwt = require('jsonwebtoken');
const SECRET = process.env.JWT_SECRET;
const ALGORITHM = 'HS256';
const ACCESS_TTL = '15m';
production:
primary:
adapter: postgresql
database: app_production
username: app
password: <%= ENV["PRIMARY_DB_PASSWORD"] %>
import { AsyncLocalStorage } from 'node:async_hooks';
interface Store {
requestId: string;
}