REST API

DearDiary.APIConfigType
APIConfig

A struct to hold the configuration for the API server.

Fields

  • host::String: The host of the API server.
  • port::UInt16: The port of the API server.
  • db_file::String: The path to the SQLite database file.
  • jwt_secret::String: The JWT secret for authentication.
  • enable_auth::Bool: Whether to enable authentication or not.
  • cors_origins::Vector{String}: Browser origins allowed to call the API. Use ["*"] to allow any origin (default in development).
  • artifact_backend::String: Which AbstractArtifactStore backend handles Resource bytes. One of "sqlite" (default, legacy inline storage), "filesystem", or "s3". Selected at server startup by the DEARDIARY_ARTIFACT_BACKEND env var.
  • artifact_fs_root::String: Root directory for the FilesystemStore backend. Honoured only when artifact_backend == "filesystem". Created on first write.
  • artifact_s3_bucket::String: Bucket name for the S3Store backend.
  • artifact_s3_endpoint::String: Scheme + host for S3 requests (e.g. https://s3.us-east-1.amazonaws.com, http://localhost:9000 for MinIO).
  • artifact_s3_region::String: Region used in the SigV4 credential scope.
  • artifact_s3_access_key::String, artifact_s3_secret_key::String: SigV4 credentials.
  • enable_ui::Bool: Set true to make DearDiary.run boot the embedded Bonito dashboard on ui_host:ui_port alongside the REST API server. Defaults to true.
  • ui_host::String: Host the dashboard binds to. Defaults to 127.0.0.1.
  • ui_port::UInt16: Port the dashboard binds to. Defaults to 9001.
source
DearDiary.runFunction
run(; env_file::String=".env")

Starts the server.

By default, the server will run on 127.0.0.1:9000. You can change both the host and port by modifying the .env file specific entries. The environment variables are loaded from the .env file by default. You can change the file path by passing the env_file argument.

source