Skip to content

opengist

Office Web - Source - Docker Image - Document


opengist 是一个由 Git 提供支持的自托管粘贴。所有代码片段都存储在 Git 存储库中,可以使用标准 Git 命令或 Web 界面读取和/或修改。它类似于 GitHub Gist,但开源并且可以自托管。


配置

使用 MEILISEARCH 作为索引

  1. 修改配置
diff
- OG_INDEX=bleve
+ OG_INDEX=meilisearch
- OG_MEILI_HOST=none
+ OG_MEILI_HOST=http://meilisearch:7700
- OG_MEILI_API_KEY=none
+ OG_MEILI_API_KEY=master-key
  1. 在后台更新索引:管理 -> 通用 -> 动作 -> 索引所有 Gists

  2. 更新字段,否则会报 500 错误

bash
curl -X PATCH 'http://meilisearch:7700/indexes/opengist/settings' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_MASTER_KEY' \
  -d '{
    "filterableAttributes": [
      "UserID",
      "Visibility",
      "Language",
      "Languages",
      "IsPublic",
      "Title",
      "GistID",
      "Owner",
      "FileName",
      "FileExtension",
      "Topic"
    ],
    "sortableAttributes": [
      "CreatedAt",
      "UpdatedAt",
      "Size"
    ]
  }'

OIDC

bash
http://opengist.url/oauth/openid-connect/callback
  • 环境变量
bash
OG_OIDC_PROVIDER_NAME=<provider-name>
OG_OIDC_CLIENT_KEY=<key>
OG_OIDC_SECRET=<secret>
# Discovery endpoint of the OpenID provider. Generally something like http://auth.example.com/.well-known/openid-configuration
OG_OIDC_DISCOVERY_URL=http://auth.example.com/.well-known/openid-configuration

注意事项

  • 如果遇到权限问题,需要执行以下命令:
bash
chmod -R 755 /opengist

Released under the Apache-2.0 License.