Skip to content
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

Config: Improve env config to support multi values. v7.0.2 #4092

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

suzp1984
Copy link
Contributor

@suzp1984 suzp1984 commented Jun 16, 2024

  1. add on_connect & on_close directives to conf/full.conf;
  2. let http_hooks env overwrite support multi values; e.g. SRS_VHOST_HTTP_HOOKS_ON_CONNECT="http://127.0.0.1/api/connect http://localhost/api/connect"

related to #1222 (comment)
Above comments said http_hook env may not works as expected, as I found there are still has some issue in http_hooks env configuration, but this PR may not target above problem.

@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Jun 16, 2024
@suzp1984 suzp1984 force-pushed the fix/http_hooks_env_overwriten branch from 5f6f0a9 to 5ba500c Compare June 16, 2024 14:33
@suzp1984 suzp1984 requested a review from winlinvip June 16, 2024 14:33
@suzp1984 suzp1984 force-pushed the fix/http_hooks_env_overwriten branch from 5ba500c to f33f1ad Compare July 16, 2024 14:53
trunk/conf/full.conf Outdated Show resolved Hide resolved
@winlinvip winlinvip changed the title fix http_hooks env don't support multi values; Config: Fix http_hooks env don't support multi values; Aug 12, 2024
@winlinvip winlinvip changed the title Config: Fix http_hooks env don't support multi values; Config: Improve env config to support multi values Aug 12, 2024
@winlinvip winlinvip force-pushed the develop branch 2 times, most recently from 0bb9637 to 2e211f6 Compare August 12, 2024 10:42
  let http_hooks env overwrite support multi values;
   e.g. SRS_VHOST_HTTP_HOOKS_ON_CONNECT="http://127.0.0.1/api/connect
   http://localhost/api/connect"
@suzp1984 suzp1984 force-pushed the fix/http_hooks_env_overwriten branch from f33f1ad to b49ed17 Compare August 12, 2024 12:19
@winlinvip winlinvip changed the title Config: Improve env config to support multi values Config: Improve env config to support multi values. v7.0.2 Aug 13, 2024
@winlinvip winlinvip added the RefinedByAI Refined by AI/GPT. label Aug 13, 2024
@winlinvip winlinvip merged commit 16e569d into ossrs:develop Aug 13, 2024
17 checks passed
winlinvip added a commit that referenced this pull request Aug 13, 2024
1. add on_connect & on_close directives to conf/full.conf;
2. let http_hooks env overwrite support multi values; e.g.
SRS_VHOST_HTTP_HOOKS_ON_CONNECT="http://127.0.0.1/api/connect
http://localhost/api/connect"

related to
#1222 (comment)
Above comments said `http_hook` env may not works as expected, as I
found there are still has some issue in `http_hooks` env configuration,
but this PR may not target above problem.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
winlinvip added a commit that referenced this pull request Aug 15, 2024
1. don't use static variable to store the result;
2. add more UT to handle the multi value and values with whitespaces;

related to #4092 


https://github.com/ossrs/srs/blob/16e569d82357757ddac6ef91d7a5fe7837319909/trunk/src/app/srs_app_config.cpp#L71-L82

`static SrsConfDirective* dir` removed, this static var here is to avoid
the memory leak, I add the `SrsConfDirective` instance to the `env_dirs`
directive container, which will destroy itself inside `SrsConfig`
destructor.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
winlinvip added a commit that referenced this pull request Aug 15, 2024
1. don't use static variable to store the result;
2. add more UT to handle the multi value and values with whitespaces;

related to #4092

https://github.com/ossrs/srs/blob/16e569d82357757ddac6ef91d7a5fe7837319909/trunk/src/app/srs_app_config.cpp#L71-L82

`static SrsConfDirective* dir` removed, this static var here is to avoid
the memory leak, I add the `SrsConfDirective` instance to the `env_dirs`
directive container, which will destroy itself inside `SrsConfig`
destructor.

---------

Co-authored-by: winlin <winlinvip@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EnglishNative This issue is conveyed exclusively in English. RefinedByAI Refined by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants