Code error: Incorrect config key name #4643

Closed
opened 2026-02-21 18:07:22 -05:00 by yindo · 1 comment
Owner

Originally created by @yujunhui on GitHub (Jul 17, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.13

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In the reading of the source code, I found that the configuration key name is incorrect.
https://github.com/langgenius/dify/blob/17f22347ae5971f3b325ac99ade6a9e81061c581/api/configs/feature/hosted_service/__init__.py#L82-L85

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @yujunhui on GitHub (Jul 17, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.13 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce In the reading of the source code, I found that the configuration key name is incorrect. https://github.com/langgenius/dify/blob/17f22347ae5971f3b325ac99ade6a9e81061c581/api/configs/feature/hosted_service/__init__.py#L82-L85 ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:07:22 -05:00
yindo closed this issue 2026-02-21 18:07:22 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 17, 2024):

@yujunhui Hello there! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let me know how I can assist you.

To correct the configuration key name in the Dify project, you need to change the key name from inner_CONSOLE_CORS_ALLOW_ORIGINS to INNER_CONSOLE_CORS_ALLOW_ORIGINS in the HttpConfig class. Here is the corrected code:

class HttpConfig(BaseModel):
    """
    HTTP configs
    """
    API_COMPRESSION_ENABLED: bool = Field(
        description='whether to enable HTTP response compression of gzip',
        default=False,
    )

    INNER_CONSOLE_CORS_ALLOW_ORIGINS: str = Field(
        description='',
        validation_alias=AliasChoices('CONSOLE_CORS_ALLOW_ORIGINS', 'CONSOLE_WEB_URL'),
        default='',
    )

    @computed_field
    @property
    def CONSOLE_CORS_ALLOW_ORIGINS(self) -> list[str]:
        return self.INNER_CONSOLE_CORS_ALLOW_ORIGINS.split(',')

    inner_WEB_API_CORS_ALLOW_ORIGINS: Optional[str] = Field(
        description='',
        validation_alias=AliasChoices('WEB_API_CORS_ALLOW_ORIGINS'),
        default='*',
    )

    @computed_field
    @property
    def WEB_API_CORS_ALLOW_ORIGINS(self) -> list[str]:
        return self.inner_WEB_API_CORS_ALLOW_ORIGINS.split(',')

This change ensures that the key name is consistent with the naming convention used in the rest of the configuration [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 17, 2024): <!-- Greeting --> @yujunhui Hello there! I'm here to help you with any bugs, questions, or contributions you have for the repository. Let me know how I can assist you. <!-- Answer --> To correct the configuration key name in the Dify project, you need to change the key name from `inner_CONSOLE_CORS_ALLOW_ORIGINS` to `INNER_CONSOLE_CORS_ALLOW_ORIGINS` in the `HttpConfig` class. Here is the corrected code: ```python class HttpConfig(BaseModel): """ HTTP configs """ API_COMPRESSION_ENABLED: bool = Field( description='whether to enable HTTP response compression of gzip', default=False, ) INNER_CONSOLE_CORS_ALLOW_ORIGINS: str = Field( description='', validation_alias=AliasChoices('CONSOLE_CORS_ALLOW_ORIGINS', 'CONSOLE_WEB_URL'), default='', ) @computed_field @property def CONSOLE_CORS_ALLOW_ORIGINS(self) -> list[str]: return self.INNER_CONSOLE_CORS_ALLOW_ORIGINS.split(',') inner_WEB_API_CORS_ALLOW_ORIGINS: Optional[str] = Field( description='', validation_alias=AliasChoices('WEB_API_CORS_ALLOW_ORIGINS'), default='*', ) @computed_field @property def WEB_API_CORS_ALLOW_ORIGINS(self) -> list[str]: return self.inner_WEB_API_CORS_ALLOW_ORIGINS.split(',') ``` This change ensures that the key name is consistent with the naming convention used in the rest of the configuration <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/configs/feature/__init__.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4643