casdoor / casdoor

An open-source UI-first Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, RADIUS, Google Workspace, Active Directory and Kerberos
https://casdoor.org
Apache License 2.0
9.2k stars 1.09k forks source link

[bug] version cannot be displayed in all-in-one docker image #2981

Open hsluoyz opened 3 weeks ago

hsluoyz commented 3 weeks ago

Use Docker Option-1 to install Casdoor: https://casdoor.org/docs/basic/try-with-docker#option-1-use-the-toy-database

Go to: http://localhost:8000/sysinfo , the version is empty:

image

It should work like the non-Docker demo site: https://door.casdoor.com/sysinfo

image

casbin-bot commented 3 weeks ago

@tangyang9464 @JalinWang @imp2002

seeleclover commented 3 weeks ago

I have identified the cause of the problem.

When I used Docker to install Casdoor, I initiated debugging on the /api/get-version-info interface and received a return message of "msg": "repository does not exist". This indicates that this interface gets the version by reading the Git History. However, the content packaged into Docker does not include the Git History.

I found in controllers/systeminfo.go that although there are two ways to get the version when this interface is called, in any case, when the first method fails, it will immediately return the exception to the front-end.

seeleclover commented 3 weeks ago

I think this interface should determine which method to use to obtain the version based on the runmode in conf/app.conf. If it is dev, then obtain the version through Git History; If it is prod, then obtain the version through version_info.txt.

seeleclover commented 3 weeks ago

May I ask, how would it be more appropriate to solve this problem? Or rather, follow the original logic of the program. First, try to obtain the version through Git History. If the retrieval fails, then retrieve the version through the version_info.txt ? @hsluoyz

hsluoyz commented 3 weeks ago

@seeleclover we will fix it by ourselves

seeleclover commented 3 weeks ago

OK, thanks.