Skip to content

Commit

Permalink
allow empty endpoint in enterprise flusher_sls to avoid unsuccessful …
Browse files Browse the repository at this point in the history
…load of config (#1486)
  • Loading branch information
henryzhx8 committed May 16, 2024
1 parent ddb5b86 commit d5fa94c
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions core/flusher/FlusherSLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,33 @@ bool FlusherSLS::Init(const Json::Value& config, Json::Value& optionalGoPipeline
}

// Endpoint
if (!GetMandatoryStringParam(config, "Endpoint", mEndpoint, errorMsg)) {
PARAM_ERROR_RETURN(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
}
mEndpoint = TrimString(mEndpoint);
if (!mEndpoint.empty()) {
Sender::Instance()->AddEndpointEntry(mRegion, StandardizeEndpoint(mEndpoint, mEndpoint));
#ifdef __ENTERPRISE__
if (!GetOptionalStringParam(config, "Endpoint", mEndpoint, errorMsg)) {
PARAM_WARNING_IGNORE(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
} else {
#else
if (!GetMandatoryStringParam(config, "Endpoint", mEndpoint, errorMsg)) {
PARAM_ERROR_RETURN(mContext->GetLogger(),
mContext->GetAlarm(),
errorMsg,
sName,
mContext->GetConfigName(),
mContext->GetProjectName(),
mContext->GetLogstoreName(),
mContext->GetRegion());
} else {
#endif
mEndpoint = TrimString(mEndpoint);
if (!mEndpoint.empty()) {
Sender::Instance()->AddEndpointEntry(mRegion, StandardizeEndpoint(mEndpoint, mEndpoint));
}
}
#ifdef __ENTERPRISE__
}
Expand Down

0 comments on commit d5fa94c

Please # to comment.