captive-portal

logo

Purchase a cup of coffee to get access to the internet.

Quick Start

Start dependencies

docker-compose up -d

Copy the example config file

cp config.example.yaml config.yaml

Modify config file

# config.yaml
app:
  name: "captive-portal"
  env: "dev"  # Change to "prod" in production environment
  host: 127.0.0.1
  port: 8080
  graceful_timeout_second: 0.1
  log_level: "debug"

newrelic:
  license_key: "example"  # Change to your own license key

openwrt:
  encryption_key: "example"  # Change to the own encryption key of OpenNDS

redis:
  host: 127.0.0.1
  port: 6379
  db: 0
  password: ""  # Change to your own redis password or Refer to docker-compose.yml

db:
  host: 127.0.0.1
  port: 5432
  user: "postgres"
  name: "captive-portal"
  password: "example"  # Change to your own postgres password or Refer to docker-compose.yml

Run the application. The configuration file is in the current directory by default.

go run main.go

Formatting

Format code

make format

Check formatting

make lint

DB schema modifications

If you want to modify the database schema, you should modify the schema file directly.

And then generate models from the database

make models

After you finished, dump the database schema

make dump-db

Restore database

make restore-db