create ConfigManager source files
This commit is contained in:
parent
73576f26f2
commit
48953b1c62
42
.github/workflows/clang-format.yml
vendored
42
.github/workflows/clang-format.yml
vendored
@ -1,42 +0,0 @@
|
|||||||
name: Clang Format & Tidy
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
clang-tools:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write # Needed to push changes back
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.head_ref }} # checkout the PR branch so we can push back
|
|
||||||
|
|
||||||
- name: Install clang tools
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y clang-format clang-tidy
|
|
||||||
|
|
||||||
- name: Run clang-format and auto-fix
|
|
||||||
run: |
|
|
||||||
FILES=$(find . -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp')
|
|
||||||
clang-format -i $FILES
|
|
||||||
|
|
||||||
- name: Commit and push changes (if any)
|
|
||||||
run: |
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add -u
|
|
||||||
if ! git diff --cached --quiet; then
|
|
||||||
git commit -m "Apply clang-format fixes"
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "No formatting changes needed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
@ -1,5 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <webserv/ConfigManager/ConfigManager.hpp>
|
#include <webserv/config/ConfigManager.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ConfigManager::ConfigManager() : _initialized(false)
|
ConfigManager::ConfigManager() : _initialized(false)
|
||||||
{
|
{
|
||||||
0
webserv/config/LocationConfig.cpp
Normal file
0
webserv/config/LocationConfig.cpp
Normal file
0
webserv/config/LocationConfig.hpp
Normal file
0
webserv/config/LocationConfig.hpp
Normal file
0
webserv/config/ServerConfig.cpp
Normal file
0
webserv/config/ServerConfig.cpp
Normal file
0
webserv/config/ServerConfig.hpp
Normal file
0
webserv/config/ServerConfig.hpp
Normal file
@ -1,4 +1,5 @@
|
|||||||
#include <webserv/ConfigManager/ConfigManager.hpp>
|
#include <system_error>
|
||||||
|
#include <webserv/config/ConfigManager.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -6,18 +7,13 @@
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
std::vector<std::string> args;
|
|
||||||
args.reserve(static_cast<size_t>(argc));
|
|
||||||
for (int i = 0; i < argc; ++i)
|
|
||||||
{
|
|
||||||
args.emplace_back(argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
std::cerr << "Usage: " << args[0] << " <config_file_path>\n";
|
std::cerr << "Usage: " << argv[0] << " <config_file_path>\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ConfigManager::getInstance().init(args[1]);
|
ConfigManager::getInstance().init(argv[1]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user