changes to env still and init-schema.sql

This commit is contained in:
2025-04-07 16:39:57 -04:00
parent 15fad1b10c
commit 846f5475db
2 changed files with 20 additions and 6 deletions

View File

@@ -1,12 +1,15 @@
# Flask # Flask
FLASK_SECRET_KEY=your-secret-key FLASK_SECRET_KEY=your-secret-key
# MariaDB container # Database config (shared by all)
MYSQL_HOST=db DB_HOST=db
DB_PORT=3306
DB_NAME=radius
DB_USER=radiususer
DB_PASSWORD=radiuspass
# Only used by the MariaDB container
MARIADB_ROOT_PASSWORD=rootpassword MARIADB_ROOT_PASSWORD=rootpassword
MARIADB_DATABASE=radius
MARIADB_USER=radiususer
MARIADB_PASSWORD=radiuspass
# MAC Lookup API # MAC Lookup API
OUI_API_KEY= # only required if you want to increase the OUI limits OUI_API_KEY= # only required if you want to increase the OUI limits

View File

@@ -1,5 +1,16 @@
-- init-schema.sql -- Create the database if it doesn't exist
CREATE DATABASE IF NOT EXISTS radius;
USE radius; USE radius;
-- Create the user if it doesn't exist
CREATE USER IF NOT EXISTS 'radiususer'@'%' IDENTIFIED BY 'radiuspass';
-- Grant permissions to the user
GRANT ALL PRIVILEGES ON radius.* TO 'radiususer'@'%';
-- Apply the changes
FLUSH PRIVILEGES;
-- Table for registered users (MAC-based auth) -- Table for registered users (MAC-based auth)
CREATE TABLE IF NOT EXISTS users ( CREATE TABLE IF NOT EXISTS users (
mac_address CHAR(12) NOT NULL PRIMARY KEY CHECK (mac_address REGEXP '^[0-9A-Fa-f]{12}$'), mac_address CHAR(12) NOT NULL PRIMARY KEY CHECK (mac_address REGEXP '^[0-9A-Fa-f]{12}$'),