Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Installation
INSTALL_PORT=80
AUTO_INSTALL=false

# Database
DB_TYPE=
DB_USERNAME=
DB_PASSWORD=
DB_HOST=
DB_NAME=
DB_FILE=

# Site
LANGUAGE=en-US
SITE_NAME=Apache Answer
SITE_URL=
CONTACT_EMAIL=

# Admin
ADMIN_NAME=
ADMIN_PASSWORD=
ADMIN_EMAIL=

# Content
EXTERNAL_CONTENT_DISPLAY=ask_before_display

# Swagger
SWAGGER_HOST=
SWAGGER_ADDRESS_PORT=

# Server
SITE_ADDR=0.0.0.0:3000

# Logging
LOG_LEVEL=INFO
LOG_PATH=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ dist/

# Lint setup generated file
.husky/

# Environment variables
.env
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ You can also check out the [plugins here](https://answer.apache.org/plugins).
- [mockgen](https://github.com/uber-go/mock?tab=readme-ov-file#installation) >= 0.6.0
- [wire](https://github.com/google/wire/) >= 0.5.0

### Environment Configuration

You may create a `.env` file in the project root.
Copy `.env.example` and fill required values.

```bash
cp .env.example .env


### Build

```bash
Expand Down
6 changes: 6 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ import (
"github.com/apache/answer/internal/base/path"
"github.com/apache/answer/internal/schema"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
"github.com/segmentfault/pacman"
"github.com/segmentfault/pacman/contrib/log/zap"
"github.com/segmentfault/pacman/contrib/server/http"
"github.com/segmentfault/pacman/log"
)

func init() {
// Load .env if present, ignore error to keep backward compatibility
_ = godotenv.Load()
}

// go build -ldflags "-X github.com/apache/answer/cmd.Version=x.y.z"
var (
// Name is the name of the project
Expand Down
25 changes: 25 additions & 0 deletions data/conf/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
debug: false
server:
http:
addr: 0.0.0.0:80
data:
database:
driver: sqlite3
connection: ./data/answer.db
cache:
file_path: data/cache/cache.db
i18n:
bundle_dir: data/i18n
service_config:
upload_path: data/uploads
clean_up_uploads: true
clean_orphan_uploads_period_hours: 48
purge_deleted_files_period_days: 30
swaggerui:
show: true
protocol: http
host: 127.0.0.1
address: :80
ui:
base_url: ""
api_base_url: ""
Loading