Skip to content

Commit

Permalink
🩹 fix: auths ip and dockerfile creation
Browse files Browse the repository at this point in the history
  • Loading branch information
camargo2019 committed Sep 11, 2024
1 parent 7d9a70c commit 3bdf00f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 10 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
choco install llvm
curl -L -o boost.zip https://storage.cmr.dev.br/boost.zip
unzip boost.zip -d boost
- os: fedora-latest
install: sudo dnf install -y clang boost-devel
- os: centos-latest
install: sudo yum install -y clang boost-devel
steps:
- name: Checkout code
Expand Down
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:latest as cmr_cache

USER root

RUN apt update -y && \
apt upgrade -y && \
apt install -y libboost-all-dev clang && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/cmr-cache/

COPY . /tmp/build-cmr-cache/

RUN cd /tmp/build-cmr-cache/ && \
clang++ -o cmr_cache main.cpp -I./vendor/yaml -I/usr/include/boost -L/usr/lib/x86_64-linux-gnu -lboost_system -lpthread -std=c++17 && \
cp cmr_cache /usr/cmr-cache/ && \
cp -r config/ /usr/cmr-cache/ && \
rm -rf /tmp/build-cmr-cache/

ENTRYPOINT [ "./cmr_cache" ]
14 changes: 8 additions & 6 deletions core/entities/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@

Yaml::Node& authIPs = auth["allow-ip"];

if (authIPs.IsSequence() == false){
throw std::runtime_error("ERROR: allow-ip is not a sequence in config/connect.yaml");
}

for (auto aIP = authIPs.Begin(); aIP != authIPs.End(); aIP++){
config_connect.auth.allow_ip.push_back((*aIP).second.As<std::string>());
if (!authIPs.IsNone()){
if (authIPs.IsSequence() == false){
throw std::runtime_error("ERROR: allow-ip is not a sequence in config/connect.yaml");
}

for (auto aIP = authIPs.Begin(); aIP != authIPs.End(); aIP++){
config_connect.auth.allow_ip.push_back((*aIP).second.As<std::string>());
}
}

Yaml::Node& basicAuth = auth["basic"];
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3"

services:
cache:
container_name: cmr-cache
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- "6347:6347"
volumes:
- cmr-cache-data:/usr/cmr-cache/data/


volumes:
cmr-cache-data:
driver: local

0 comments on commit 3bdf00f

Please sign in to comment.