diff --git a/apphub/src/apphub.egg-info/PKG-INFO b/apphub/src/apphub.egg-info/PKG-INFO new file mode 100644 index 00000000..bc6a0c19 --- /dev/null +++ b/apphub/src/apphub.egg-info/PKG-INFO @@ -0,0 +1,3 @@ +Metadata-Version: 2.1 +Name: apphub +Version: 0.2 diff --git a/apphub/src/apphub.egg-info/SOURCES.txt b/apphub/src/apphub.egg-info/SOURCES.txt new file mode 100644 index 00000000..0a6e8238 --- /dev/null +++ b/apphub/src/apphub.egg-info/SOURCES.txt @@ -0,0 +1,10 @@ +README.md +setup.py +src/apphub.egg-info/PKG-INFO +src/apphub.egg-info/SOURCES.txt +src/apphub.egg-info/dependency_links.txt +src/apphub.egg-info/entry_points.txt +src/apphub.egg-info/requires.txt +src/apphub.egg-info/top_level.txt +src/cli/__init__.py +src/cli/apphub_cli.py \ No newline at end of file diff --git a/apphub/src/apphub.egg-info/dependency_links.txt b/apphub/src/apphub.egg-info/dependency_links.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/apphub/src/apphub.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/apphub/src/apphub.egg-info/entry_points.txt b/apphub/src/apphub.egg-info/entry_points.txt new file mode 100644 index 00000000..e365cb8a --- /dev/null +++ b/apphub/src/apphub.egg-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +apphub = cli.apphub_cli:cli diff --git a/apphub/src/apphub.egg-info/requires.txt b/apphub/src/apphub.egg-info/requires.txt new file mode 100644 index 00000000..dca9a909 --- /dev/null +++ b/apphub/src/apphub.egg-info/requires.txt @@ -0,0 +1 @@ +click diff --git a/apphub/src/apphub.egg-info/top_level.txt b/apphub/src/apphub.egg-info/top_level.txt new file mode 100644 index 00000000..573c0c4f --- /dev/null +++ b/apphub/src/apphub.egg-info/top_level.txt @@ -0,0 +1 @@ +cli diff --git a/apphub/src/cli/apphub_cli.py b/apphub/src/cli/apphub_cli.py index e176e3c4..ed3358e1 100755 --- a/apphub/src/cli/apphub_cli.py +++ b/apphub/src/cli/apphub_cli.py @@ -16,6 +16,12 @@ def genkey(): key = APIKeyManager().generate_key() click.echo(f"{key}") +@cli.command() +def getkey(): + """Get the API key""" + key = APIKeyManager().get_key() + click.echo(f"{key}") + @cli.command() @click.option('--section',required=True, help='The section name') @click.option('--key', required=True, help='The key name') diff --git a/apphub/src/config/config.ini b/apphub/src/config/config.ini index 55a693f9..4455c4f6 100755 --- a/apphub/src/config/config.ini +++ b/apphub/src/config/config.ini @@ -4,8 +4,6 @@ user_name = help@websoft9.com user_pwd = 4yB5fU93GO4wMvxS nike_name = admin -#The config for gitea. -# entrypoint.sh will get the user_name and email default value,it mean these must the gitea default [gitea] base_url = http://websoft9-git:3000/api/v1 user_name = websoft9 diff --git a/apphub/src/services/apikey_manager.py b/apphub/src/services/apikey_manager.py index c316a386..c7a925a4 100755 --- a/apphub/src/services/apikey_manager.py +++ b/apphub/src/services/apikey_manager.py @@ -25,6 +25,16 @@ class APIKeyManager: logger.error("Error generating API key"+str(e)) raise CustomException() + def get_key(self): + """ + Get the API key. + """ + try: + return ConfigManager().get_value('api_key', 'key') + except Exception as e: + logger.error("Error getting API key"+str(e)) + raise CustomException() + def delete_key(self): """ Delete the API key. diff --git a/source/docker/apphub/Dockerfile b/source/docker/apphub/Dockerfile index e1592533..f48408ef 100644 --- a/source/docker/apphub/Dockerfile +++ b/source/docker/apphub/Dockerfile @@ -1,4 +1,4 @@ -# modify time: 202310181824, you can modify here to trigger Docker Build action +# modify time: 202310191140, you can modify here to trigger Docker Build action FROM python:3.10-bullseye AS buildstage LABEL maintainer="Websoft9" diff --git a/source/docker/apphub/config/entrypoint.sh b/source/docker/apphub/config/entrypoint.sh index 42694a54..92bf0bf1 100644 --- a/source/docker/apphub/config/entrypoint.sh +++ b/source/docker/apphub/config/entrypoint.sh @@ -2,7 +2,7 @@ set -e -try_times=3 +try_times=5 # start by supervisord /usr/bin/supervisord @@ -12,31 +12,30 @@ supervisorctl start apphub # set git user and email for ((i=0; i<$try_times; i++)); do set +e - username=$(apphub getconfig --section gitea --key user_name) - email=$(apphub getconfig --section gitea --key email) + username=$(apphub getconfig --section gitea --key user_name 2>/dev/null) + email=$(apphub getconfig --section gitea --key user_email 2>/dev/null) set -e if [ -n "$username" ] && [ -n "$email" ]; then break fi - echo "Command failed, retrying..." + echo "Wait for service running, retrying..." sleep 3 done -echo $username -echo $email - if [[ -n "$username" ]]; then + echo "git config --global user.name $username" git config --global user.name "$username" else - echo "username is null" + echo "username is null, git config username failed" exit 1 fi regex="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" if [[ $email =~ $regex ]]; then + echo "git config --global user.email $email" git config --global user.email "$email" else - echo "Not have correct email" + echo "Not have correct email, git config email failed" exit 1 fi diff --git a/source/version.json b/source/version.json index 3d88356b..4fca4be2 100644 --- a/source/version.json +++ b/source/version.json @@ -1,5 +1,5 @@ { - "version": "0.8.26-rc68", + "version": "0.8.26-rc69", "plugins": { "portainer": "0.0.7", "nginx": "0.0.5",