fix: add oauth jwt token

This commit is contained in:
Emmanuel Averty 2023-08-08 22:54:06 +02:00 committed by grosmanal
parent c4e105f786
commit 2a986b38e6
3 changed files with 54 additions and 44 deletions

View file

@ -62,7 +62,6 @@ PROVIDER = memory
MODE = file MODE = file
LEVEL = Info LEVEL = Info
ROOT_PATH = /var/log/__APP__ ROOT_PATH = /var/log/__APP__
logger.access.MODE = logger.access.MODE =
logger.router.MODE = router logger.router.MODE = router
logger.xorm.MODE = xorm logger.xorm.MODE = xorm
@ -85,3 +84,6 @@ REVERSE_PROXY_AUTHENTICATION_USER = REMOTE-USER
REVERSE_PROXY_AUTHENTICATION_EMAIL = EMAIL REVERSE_PROXY_AUTHENTICATION_EMAIL = EMAIL
REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128 REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128
INTERNAL_TOKEN = __INTERNAL_TOKEN__ INTERNAL_TOKEN = __INTERNAL_TOKEN__
[oauth2]
JWT_SECRET = __OAUTH2_JWT_SECRET__

View file

@ -29,9 +29,11 @@ chown -R $app:$app "$install_dir/custom"
secret_key=$($install_dir/forgejo generate secret SECRET_KEY) secret_key=$($install_dir/forgejo generate secret SECRET_KEY)
lfs_jwt_secret=$($install_dir/forgejo generate secret JWT_SECRET) lfs_jwt_secret=$($install_dir/forgejo generate secret JWT_SECRET)
internal_token=$($install_dir/forgejo generate secret INTERNAL_TOKEN) internal_token=$($install_dir/forgejo generate secret INTERNAL_TOKEN)
oauth2_jwt_secret=$($install_dir/forgejo generate secret JWT_SECRET)
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
ynh_app_setting_set --app=$app --key=lfs_jwt_secret --value=$lfs_jwt_secret ynh_app_setting_set --app=$app --key=lfs_jwt_secret --value=$lfs_jwt_secret
ynh_app_setting_set --app=$app --key=internal_token --value=$internal_token ynh_app_setting_set --app=$app --key=internal_token --value=$internal_token
ynh_app_setting_set --app=$app --key=oauth2_jwt_secret --value=$oauth2_jwt_secret
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION

View file

@ -80,6 +80,12 @@ if [ -z ${internal_token:-} ]; then
ynh_app_setting_set --app=$app --key=internal_token --value=$internal_token ynh_app_setting_set --app=$app --key=internal_token --value=$internal_token
fi fi
# If oauth2_jwt_secret doesn't exist, create it
if [ -z ${oauth2_jwt_secret:-} ]; then
oauth2_jwt_secret=$($install_dir/forgejo generate secret JWT_SECRET)
ynh_app_setting_set --app=$app --key=oauth2_jwt_secret --value=$oauth2_jwt_secret
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================