parent
dda1e2f26e
commit
a38bab1f99
@ -1,18 +1,14 @@
|
||||
{
|
||||
"AllowedHosts": "*",
|
||||
"dbconfig": {
|
||||
"connectionstring": "Server=localhost;Port=3306;User ID=user;Password=default;Database=bantflags",
|
||||
"poolsize": 2
|
||||
},
|
||||
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
|
||||
"webroot": "/var/www/html",
|
||||
"staging-password": "supersecretpassword"
|
||||
}
|
||||
"AllowedHosts": "*",
|
||||
"dbconfig": {
|
||||
"connectionstring": "Server=localhost;Port=3306;User ID=user;Password=password;Database=bantflags",
|
||||
"poolsize": 2,
|
||||
"boards": [
|
||||
"bant",
|
||||
"nap",
|
||||
"srsbsn"
|
||||
]
|
||||
},
|
||||
"webroot": "/var/www/html",
|
||||
"staging-password": "supersecretpassword"
|
||||
}
|
||||
|
@ -1,143 +1,102 @@
|
||||
CREATE DATABASE IF NOT EXISTS bantflags;
|
||||
DROP DATABASE IF EXISTS `bantflags`;
|
||||
CREATE DATABASE `bantflags`;
|
||||
|
||||
USE bantflags;
|
||||
USE `bantflags`;
|
||||
|
||||
CREATE USER IF NOT EXISTS flags@localhost IDENTIFIED BY 'default';
|
||||
GRANT ALL PRIVILEGES ON bantflags.* TO flags@localhost;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
CREATE TABLE `flags` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`flag` varchar(100) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `flag` (`flag`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `posts` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`post_nr` int(10) NOT NULL DEFAULT '0',
|
||||
`board` varchar(10) NOT NULL DEFAULT 'bant',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `post_nr_board` (`post_nr`,`board`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `postflags` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`post_nr` int(10) NOT NULL DEFAULT '0',
|
||||
`flag` int(10) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `flag` (`flag`),
|
||||
KEY `post_nr` (`post_nr`),
|
||||
CONSTRAINT `flag` FOREIGN KEY (`flag`) REFERENCES `flags` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `post_nr` FOREIGN KEY (`post_nr`) REFERENCES `posts` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `flags` (
|
||||
`id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||
`flag` VARCHAR(100) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `flag` (`flag`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB
|
||||
AUTO_INCREMENT=0
|
||||
;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `posts` (
|
||||
`id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||
`post_nr` INT(10) NOT NULL DEFAULT '0',
|
||||
`board` VARCHAR(5) NOT NULL DEFAULT 'bant',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `post_nr` (`post_nr`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB
|
||||
AUTO_INCREMENT=0
|
||||
;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `postflags` (
|
||||
`id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||
`post_nr` INT(10) NOT NULL DEFAULT '0',
|
||||
`flag` INT(10) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `flag` (`flag`),
|
||||
INDEX `post_nr` (`post_nr`),
|
||||
CONSTRAINT `flag` FOREIGN KEY (`flag`) REFERENCES `flags` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `post_nr` FOREIGN KEY (`post_nr`) REFERENCES `posts` (`id`)
|
||||
)
|
||||
COLLATE='utf8_general_ci'
|
||||
ENGINE=InnoDB
|
||||
AUTO_INCREMENT=0
|
||||
;
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS insert_post;
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`flags`@`localhost` PROCEDURE `insert_post`(
|
||||
IN `@post_nr` INT,
|
||||
IN `@board` VARCHAR(5)
|
||||
)
|
||||
LANGUAGE SQL
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT ''
|
||||
BEGIN
|
||||
INSERT IGNORE INTO `posts` (`post_nr`, `board`) VALUES (`@post_nr`, `@board`);
|
||||
END
|
||||
CREATE DEFINER=`flags`@`localhost` PROCEDURE `insert_post`(
|
||||
IN `@post_nr` INT,
|
||||
IN `@board` VARCHAR(5)
|
||||
)
|
||||
LANGUAGE SQL
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
BEGIN
|
||||
INSERT IGNORE INTO `posts` (`post_nr`, `board`) VALUES (`@post_nr`, `@board`);
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS insert_post_flags;
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`flags`@`localhost` PROCEDURE `insert_post_flags`(
|
||||
IN `@post_nr` INT,
|
||||
IN `@flag` VARCHAR(100)
|
||||
IN `@post_nr` INT,
|
||||
IN `@flag` VARCHAR(100)
|
||||
)
|
||||
LANGUAGE SQL
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT ''
|
||||
BEGIN
|
||||
insert into postflags (post_nr, flag) VALUES (
|
||||
(select id from posts where post_nr = `@post_nr`),
|
||||
(select id from flags where flag = `@flag`)
|
||||
);
|
||||
insert into postflags (post_nr, flag) VALUES (
|
||||
(select id from posts where post_nr = `@post_nr`),
|
||||
(select id from flags where flag = `@flag`)
|
||||
);
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS rename_flag;
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`flags`@`localhost` PROCEDURE `rename_flag`(
|
||||
IN `@old` VARCHAR(100),
|
||||
IN `@new` VARCHAR(100)
|
||||
|
||||
IN `@old` VARCHAR(100),
|
||||
IN `@new` VARCHAR(100)
|
||||
)
|
||||
LANGUAGE SQL
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT ''
|
||||
BEGIN
|
||||
UPDATE flags SET flags.flag = `@new` WHERE flags.flag = `@old`;
|
||||
UPDATE flags SET flags.flag = `@new` WHERE flags.flag = `@old`;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS delete_flag;
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`flags`@`localhost` PROCEDURE `delete_flag`(
|
||||
IN `@flag` VARCHAR(100)
|
||||
|
||||
IN `@flag` VARCHAR(100)
|
||||
)
|
||||
LANGUAGE SQL
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT ''
|
||||
BEGIN
|
||||
DELETE flags.* FROM flags WHERE flags.flag = `@flag`;
|
||||
DELETE flags.* FROM flags WHERE flags.flag = `@flag`;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
DROP PROCEDURE IF EXISTS insert_flag;
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`flags`@`localhost` PROCEDURE `insert_flag`(
|
||||
IN `@flag` VARCHAR(100)
|
||||
|
||||
|
||||
IN `@flag` VARCHAR(100)
|
||||
)
|
||||
LANGUAGE SQL
|
||||
NOT DETERMINISTIC
|
||||
CONTAINS SQL
|
||||
SQL SECURITY DEFINER
|
||||
COMMENT ''
|
||||
BEGIN
|
||||
INSERT INTO `flags` (`flag`) VALUES (`@flag`);
|
||||
INSERT INTO `flags` (`flag`) VALUES (`@flag`);
|
||||
END
|
||||
$$
|
||||
DELIMITER ;
|
||||
DELIMITER ;
|
||||
|
@ -0,0 +1,36 @@
|
||||
events {
|
||||
worker_connections 768;
|
||||
}
|
||||
|
||||
http {
|
||||
types {
|
||||
text/html html htm shtm;
|
||||
text/css css;
|
||||
image/gif gif;
|
||||
image/jpeg jpg jpeg;
|
||||
image/png png;
|
||||
}
|
||||
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
charset utf-8;
|
||||
index index.htm index.html;
|
||||
|
||||
server {
|
||||
root /var/www/flags;
|
||||
server_name flags.plum.moe;
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue