mirror of https://github.com/yandex/odyssey.git
Added config testing (odyssey --test) (#537)
* added configuration testing (odyssey --test) * fixes * fix names * fix names * apply fmt * start create tests * rebuild * tests done * --test no longer forks the process * config without rules is no longer valid * fix tests * fix storage_type tests * fix storage_tls tests * fix config-examples/odyssey-aq.conf * change .gitignore * rm .DS_Store
This commit is contained in:
parent
5f4e64d110
commit
9a423940b9
|
@ -28,3 +28,4 @@ docker/bin/odyssey-asan
|
|||
odyssey.conf.example
|
||||
odyssey.init
|
||||
odyssey.logrotate
|
||||
.DS_Store
|
||||
|
|
|
@ -2,16 +2,20 @@ FROM golang:latest as base
|
|||
|
||||
RUN mkdir -p /ody-integration-test
|
||||
RUN mkdir -p /prep_stmts
|
||||
RUN mkdir -p /config-validation
|
||||
COPY ./docker/ody-integration-test /ody-integration-test
|
||||
COPY ./docker/prep_stmts /prep_stmts
|
||||
COPY ./docker/config-validation /config-validation
|
||||
|
||||
WORKDIR /ody-integration-test
|
||||
|
||||
RUN go mod download && cd pkg && go build -o ody-integration-test
|
||||
|
||||
WORKDIR /prep_stmts
|
||||
RUN go mod download && cd pkg && go build -o pstmts-test
|
||||
|
||||
WORKDIR /config-validation
|
||||
RUN go mod download && cd pkg && go build -o config-validation
|
||||
|
||||
FROM ubuntu:focal
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
@ -58,9 +62,11 @@ RUN mkdir /tmp/odyssey
|
|||
COPY ./docker/odyssey.conf /etc/odyssey/odyssey.conf
|
||||
COPY ./docker/lagpolling/lag-conf.conf /etc/odyssey/lag-conf.conf
|
||||
COPY ./docker/prep_stmts/pstmts.conf /etc/odyssey/pstmts.conf
|
||||
COPY ./docker/config-validation/configs /etc/odyssey/configs
|
||||
|
||||
COPY --from=base /ody-integration-test/pkg/ody-integration-test /ody-integration-test
|
||||
COPY --from=base /prep_stmts/pkg/pstmts-test /pstmts-test
|
||||
COPY --from=base /config-validation/pkg/config-validation /config-validation
|
||||
COPY ./docker/scram /scram
|
||||
COPY ./docker/hba /hba
|
||||
COPY ./docker/auth_query /auth_query
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
auth_query "auth_query"
|
||||
auth_query_db "db"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
auth_query "auth_query"
|
||||
auth_query_user "user"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
auth_query "auth_query"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
auth_query "auth_query"
|
||||
auth_query_user "user"
|
||||
auth_query_db "db"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "md5"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "scram-sha-256"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "kek"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "cert"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "clear_text"
|
||||
password "password"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "md5"
|
||||
password "password"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "md5"
|
||||
auth_query "auth_query"
|
||||
auth_query_user "user"
|
||||
auth_query_db "db"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "scram-sha-256"
|
||||
auth_query "auth_query"
|
||||
auth_query_user "user"
|
||||
auth_query_db "db"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "scram-sha-256"
|
||||
password "password"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "md5"
|
||||
auth_query "auth_query"
|
||||
password "password"
|
||||
auth_query_user "user"
|
||||
auth_query_db "db"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "scram-sha-256"
|
||||
auth_query "auth_query"
|
||||
password "password"
|
||||
auth_query_user "user"
|
||||
auth_query_db "db"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
coroutine_stack_size 3
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
coroutine_stack_size 0
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
coroutine_stack_size -1
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
coroutine_stack_size "123"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
coroutine_stack_size 4
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
coroutine_stack_size 10
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
workers 0
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
|
@ -0,0 +1,20 @@
|
|||
workers 1
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls ""
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "123"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "disabl"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls disable
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "disable"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "allow"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "require"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "verify_ca"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
tls "verify_full"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement yes
|
||||
pool_discard yes
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement yes
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement no
|
||||
pool_smart_discard yes
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement yes
|
||||
pool_discard_query yes
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement yes
|
||||
pool_discard no
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement no
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
pool_reserve_prepared_statement yes
|
||||
pool_discard_query "no"
|
||||
pool_discard no
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "kek"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "internal"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "client_visible"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "kek"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "transaction"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "statement"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
resolvers 0
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
resolvers -10
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
resolvers "10"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
resolvers 1
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
resolvers 10
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "123"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "disabl"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls disable
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "disable"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "allow"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "require"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "verify_ca"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
tls "verify_full"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "internal"
|
||||
role "admin"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "internal"
|
||||
role "stat"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "internal"
|
||||
role "notallow"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
pool_routing "internal"
|
||||
role "undef"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
host "*"
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "local"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
unix_socket_dir "/tmp"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
workers 0
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
workers -10
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
workers "123"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
workers 1
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
workers 10
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
workers "auto"
|
||||
|
||||
log_format "%p %t %l [%i %s] (%c) %m\n"
|
||||
|
||||
listen {
|
||||
host "*"
|
||||
}
|
||||
|
||||
storage "postgres_server" {
|
||||
type "remote"
|
||||
host "*"
|
||||
}
|
||||
|
||||
database "db" {
|
||||
user "user" {
|
||||
storage "postgres_server"
|
||||
pool "session"
|
||||
authentication "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
module config-validation
|
||||
|
||||
go 1.14
|
||||
|
||||
require github.com/jmoiron/sqlx v1.3.5
|
|
@ -0,0 +1,8 @@
|
|||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
|
||||
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
|
||||
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
|
||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
|
@ -0,0 +1,83 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const pathPrefix = "/etc/odyssey/configs"
|
||||
|
||||
const configIsValid = "config is valid"
|
||||
const configWithInvalidValuePass = "config with invalid value pass"
|
||||
|
||||
func makeTest(pathToConfig string, isValidConfig bool) error {
|
||||
ctx := context.TODO()
|
||||
|
||||
out, _ := exec.CommandContext(ctx, "/usr/bin/odyssey", pathToConfig, "--test").Output()
|
||||
strOut := string(out)
|
||||
|
||||
if isValidConfig && !strings.Contains(strOut, configIsValid) {
|
||||
return errors.New(strOut)
|
||||
}
|
||||
|
||||
if !isValidConfig && strings.Contains(strOut, configIsValid) {
|
||||
return errors.New(configWithInvalidValuePass)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func makeTests(field string, isValid bool) {
|
||||
var group string
|
||||
if isValid {
|
||||
group = "valid"
|
||||
} else {
|
||||
group = "invalid"
|
||||
}
|
||||
|
||||
pathToDir := pathPrefix + "/" + field + "/" + group
|
||||
configs, _ := ioutil.ReadDir(pathToDir)
|
||||
|
||||
for ind, config := range configs {
|
||||
pathToConfig := pathToDir + "/" + config.Name()
|
||||
if err := makeTest(pathToConfig, isValid); err != nil {
|
||||
fmt.Printf("%s_test_%s_%d (ERROR): %s\n", field, group, ind, err)
|
||||
} else {
|
||||
fmt.Printf("%s_test_%s_%d: Ok\n", field, group, ind)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func runTests() {
|
||||
tests := []string{
|
||||
"workers",
|
||||
"resolvers",
|
||||
"coroutine_stack_size",
|
||||
"log_format",
|
||||
"unix_socket_mode",
|
||||
"listen_empty",
|
||||
"listen_tls",
|
||||
"storage_type",
|
||||
"storage_tls",
|
||||
"storage_name",
|
||||
"pool_type",
|
||||
"pool_reserve_prepared_statement",
|
||||
"pool_routing",
|
||||
"authentication",
|
||||
"auth_query",
|
||||
"rules_empty",
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
makeTests(test, true)
|
||||
makeTests(test, false)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
runTests()
|
||||
}
|
|
@ -13,6 +13,10 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
ody-start
|
||||
/config-validation
|
||||
ody-stop
|
||||
|
||||
#ldap
|
||||
/ldap/test_ldap.sh
|
||||
if [ $? -eq 1 ]
|
||||
|
|
|
@ -50,6 +50,49 @@ void od_usage(od_instance_t *instance, char *path)
|
|||
path);
|
||||
}
|
||||
|
||||
void od_config_testing(od_instance_t *instance)
|
||||
{
|
||||
od_error_t error;
|
||||
od_router_t router;
|
||||
od_hba_t hba;
|
||||
od_global_t global;
|
||||
od_extention_t extentions;
|
||||
|
||||
od_error_init(&error);
|
||||
od_router_init(&router, &global);
|
||||
od_hba_init(&hba);
|
||||
od_extentions_init(&extentions);
|
||||
|
||||
int rc;
|
||||
rc = od_config_reader_import(&instance->config, &router.rules, &error,
|
||||
&extentions, &global, &hba.rules,
|
||||
instance->config_file);
|
||||
if (rc == -1) {
|
||||
od_error(&instance->logger, "config", NULL, NULL, "%s",
|
||||
error.error);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* validate configuration */
|
||||
rc = od_config_validate(&instance->config, &instance->logger);
|
||||
if (rc == -1) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* validate rules */
|
||||
rc = od_rules_validate(&router.rules, &instance->config,
|
||||
&instance->logger);
|
||||
if (rc == -1) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
od_log(&instance->logger, "config", NULL, NULL, "config is valid");
|
||||
|
||||
error:
|
||||
od_router_free(&router);
|
||||
return NOT_OK_RESPONSE;
|
||||
}
|
||||
|
||||
static inline void od_bind_version()
|
||||
{
|
||||
od_asprintf((char **__restrict) & argp_program_version,
|
||||
|
@ -63,6 +106,7 @@ static inline od_retcode_t od_args_init(od_arguments_t *args,
|
|||
args->silent = 0;
|
||||
args->verbose = 0;
|
||||
args->console = 0;
|
||||
args->test = 0;
|
||||
args->instance = instance;
|
||||
return OK_RESPONSE;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <argp.h>
|
||||
|
||||
extern void od_usage(od_instance_t *instance, char *path);
|
||||
extern void od_config_testing(od_instance_t *instance);
|
||||
|
||||
typedef struct {
|
||||
od_instance_t *instance;
|
||||
|
@ -12,6 +13,7 @@ typedef struct {
|
|||
int verbose;
|
||||
int console;
|
||||
int log_stdout;
|
||||
int test;
|
||||
} od_arguments_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -19,6 +21,7 @@ typedef enum {
|
|||
OD_OPT_SILENT,
|
||||
OD_OPT_VERBOSE,
|
||||
OD_OPT_LOG_STDOUT,
|
||||
OD_OPT_TEST,
|
||||
} od_cli_options;
|
||||
|
||||
static struct argp_option options[] = {
|
||||
|
@ -30,6 +33,8 @@ static struct argp_option options[] = {
|
|||
"Do not fork on startup", 0 },
|
||||
{ "log_to_stdout", OD_OPT_LOG_STDOUT, 0, OPTION_ARG_OPTIONAL,
|
||||
"Log to stdout", 0 },
|
||||
{ "test", OD_OPT_TEST, 0, OPTION_ARG_OPTIONAL, "Configuration testing",
|
||||
0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -59,6 +64,9 @@ static inline error_t parse_opt(int key, char *arg, struct argp_state *state)
|
|||
case OD_OPT_LOG_STDOUT: {
|
||||
arguments->log_stdout = 1;
|
||||
} break;
|
||||
case OD_OPT_TEST: {
|
||||
arguments->test = 1;
|
||||
} break;
|
||||
case ARGP_KEY_ARG: {
|
||||
if (state->arg_num >= 1) {
|
||||
/* Too many arguments. */
|
||||
|
@ -74,6 +82,12 @@ static inline error_t parse_opt(int key, char *arg, struct argp_state *state)
|
|||
od_usage(instance, instance->exec_path);
|
||||
return ARGP_KEY_ERROR;
|
||||
}
|
||||
|
||||
if (arguments->test == 1) {
|
||||
od_config_testing(instance);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -901,6 +901,12 @@ int od_rules_validate(od_rules_t *rules, od_config_t *config,
|
|||
od_logger_t *logger)
|
||||
{
|
||||
/* storages */
|
||||
if (od_list_empty(&rules->storages)) {
|
||||
od_error(logger, "rules", NULL, NULL,
|
||||
"no storage defined");
|
||||
return -1;
|
||||
}
|
||||
|
||||
od_list_t *i;
|
||||
od_list_foreach(&rules->storages, i)
|
||||
{
|
||||
|
@ -973,6 +979,12 @@ int od_rules_validate(od_rules_t *rules, od_config_t *config,
|
|||
}
|
||||
|
||||
/* rules */
|
||||
if (od_list_empty(&rules->rules)) {
|
||||
od_error(logger, "rules", NULL, NULL,
|
||||
"no rules defined");
|
||||
return -1;
|
||||
}
|
||||
|
||||
od_list_foreach(&rules->rules, i)
|
||||
{
|
||||
od_rule_t *rule;
|
||||
|
|
Loading…
Reference in New Issue