-
Notifications
You must be signed in to change notification settings - Fork 56
REFACTOR: refactor config file support for server configuration #934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
e3f1fad to
8e7a0ae
Compare
8e7a0ae to
6612bae
Compare
6612bae to
e78830a
Compare
fcbee46 to
59f4850
Compare
48127cd to
98e554d
Compare
98e554d to
82a1c98
Compare
a532173 to
333add5
Compare
|
ํน์ ์ด๋ฒ PR๊ณผ ๋น๊ตํด๋ณผ ์ ์๋๋ก, try_load_config_file ํจ์๋ฅผ ๋ฐ๋ก ๋ถ๋ฆฌํ์ง ์๊ณ ๋ก์ง์ main์ ์ง์ ๊ตฌํํ ๊ฒฝ์ฐ๋ ํ ๋ฒ ๋ง๋ค์ด ๋ณผ ์ ์์๊น์? |
333add5 to
6672ac3
Compare
|
ํ์ฌ ์ปค๋ฐ์ ๋ฐ๋ก ํจ์๋ฅผ ๋ถ๋ฆฌํ์ง ์๊ณ , main๋ด์ ๋ชจ๋ ์ฝ๋๋ฅผ ๋ฃ์ ๊ตฌ์กฐ์
๋๋ค. |
6672ac3 to
9dd4cc4
Compare
9dd4cc4 to
e25f6bb
Compare
| if (access_mask_str != NULL) { | ||
| settings.access = strtol(access_mask_str, NULL, 8); | ||
| free(access_mask_str); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verbose ๊ด๋ จ ์ฒ๋ฆฌ๋ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
if (settings.verbose > 0) {
perform_callbacks(ON_LOG_LEVEL, NULL, NULL);
}| { .key = "eviction", .datatype = DT_BOOL, .value.dt_bool = (bool*)&settings.evict_to_free }, | ||
| { .key = "sticky_limit", .datatype = DT_SIZE, .value.dt_size = &settings.sticky_limit }, | ||
| { .key = "factor", .datatype = DT_FLOAT, .value.dt_float = (float*)&settings.factor }, | ||
| { .key = "chunk_size", .datatype = DT_SIZE, .value.dt_size = (size_t*)&settings.chunk_size }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chunk_size๋ dt_size ํ์ ์ธ ์ด์ ๊ฐ ์๋์?
| { .key = "sticky_limit", .datatype = DT_SIZE, .value.dt_size = &settings.sticky_limit }, | ||
| { .key = "factor", .datatype = DT_FLOAT, .value.dt_float = (float*)&settings.factor }, | ||
| { .key = "chunk_size", .datatype = DT_SIZE, .value.dt_size = (size_t*)&settings.chunk_size }, | ||
| { .key = "prefix_delimiter", .datatype = DT_CHAR, .value.dt_char = &settings.prefix_delimiter}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ง์ง๋ง์ ๋์ด์ฐ๊ธฐ๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ด ํ์ํฉ๋๋ค.
๊ตฌ๋ ์ต์
์์๋ prefix_delimiter๋ฅผ ์ค์ ํ๋ฉด stats.detail_enabled๋ ์๋์ผ๋ก ์ผ์ง์ง๋ง,
์ด ๋ถ๋ถ๊ณผ๋ ๋ณ๊ฐ๋ก config ํ์ผ์์๋ ๋ ์ต์
์ ๊ฐ๊ฐ ๋
๋ฆฝ๋ ์ธ์๋ก ๋ฐ๋ ๋ฐฉ์์ด ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค.
{ .key = "detail_enabled", .datatype = DT_BOOL, .value.dt_bool = &settings.detail_enabled},
|
ํ์ฌ ํ ๊ฐ์ง ๋ฒ๊ทธ๊ฐ ์์ต๋๋ค. ์ง๊ธ์ ๊น๋ํ ๋ฐฉ์์ด ๋ฐ๋ก ๋ ์ค๋ฅด์ง๋ ์์ง๋ง, ํน์ ๋จผ์ ์์ด๋์ด๊ฐ ์์ผ์๋ฉด ์ ์ฉํด์ฃผ์๋ฉด ์ข๊ฒ ์ต๋๋ค. |
๐ Related Issue
โจ๏ธ What I did
๊ธฐ์กด์ engine ์ค์ ๋ง ๊ฐ๋ฅํ๋ config file ์ค์ ๊ธฐ๋ฅ์ ํ์ฅํ์ฌ, engine์ธ์ ๋ค๋ฅธ ์ค์ ๋ ํ์ผ ํํ๋ก ๊ฐ๋ฅํ๊ฒ ํ๋๋ก ํฉ๋๋ค.
(
-e config_file=/config_file1.conf)(๋๋ถ๋ถ์ ํ๋ก๊ทธ๋จ์์ ์ฐจ์ฉํ๋ ๋ฐฉ์)
main()์คํ์, ๊ตฌ๋์ต์ ์ ํ์ธํ๊ธฐ ์ ์ ์ฒซ๋ฒ์งธ ์ธ์๋ฅผ config file๊ฒฝ๋ก๋ฅผ ์ธ์ํ๋๋ก ๊ธฐ๋ฅ์ ํ์ฅํฉ๋๋ค.try_load_config_file()์ ๊ตฌํํ์ฌ,.confํ์ผ์ ๋ผ์ธ ๋จ์๋ก ์ฝ์ด์ ๋ชจ๋ ๊ฐ์ ์ค์ ํฉ๋๋ค.getopt์optind๋ฅผ ๋์ ์ผ๋ก ์กฐ์ ํ์ฌ config file๊ณผ ๊ตฌ๋์ต์ ์ ํผ์ฉํ ๋, ๊ตฌ๋ ์ต์ ๊ฐ์ด ๋ฎ์ด์์ด์ง๋๋ก ํฉ๋๋ค.https://github.com/jam2in/arcus-works/issues/808 ๋ฅผ ํตํ
old_opts์ค๋ณต ํด๊ฒฐgetopt(๊ตฌ๋์ต์ ๊ฐ ์ค์ )๋ฃจํ ๋ด์์settings์ ์ญ ๊ตฌ์กฐ์ฒด์old_opts๋ฌธ์์ด ์์ฑ์ ๋์์ ์ํํ๊ธฐ์, config file๊ณผ ๊ตฌ๋์ต์ ์ ๋์์ ์ํํ๋ฉดold_opts์ ์ค๋ณต๋ ๊ฐ์ด ๋ค์ด๊ฐ์ต๋๋ค.settings์ ์ญ ๊ตฌ์กฐ์ฒด๋ง ์ ๋ฐ์ดํธ๋ฅผ ์ํํ๊ณ , ํ์ฑ์ดํ์old_opts๋ฌธ์์ด์ ์์ฑํ๋๋ก ํ์ต๋๋ค.