Skip to content

Commit

Permalink
feat: record current user and host name
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Sep 3, 2022
1 parent 2a7d993 commit 7602d50
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ RUN ls -l -h

# Run the executable
ENTRYPOINT ["python", "-m", "python_boilerplate"]
CMD ["10"]
CMD ["param_1_from_command_line", "param_2_from_command_line"]
1 change: 1 addition & 0 deletions python_boilerplate/repository/model/startup_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class StartupLog(BaseModel):
"""

current_user = CharField(max_length=50, null=False)
host = CharField(max_length=50, null=False)
command_line = TextField(null=False)
startup_time = DateTimeField(default=datetime.now)
created_time = DateTimeField(default=datetime.now)
Expand Down
5 changes: 4 additions & 1 deletion python_boilerplate/repository/startup_log_repository.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import platform
import sys

Expand All @@ -14,7 +15,9 @@ def save() -> StartupLog:
:return: a StartupLog object
"""
startup_log: StartupLog = StartupLog(
current_user=platform.node(), command_line=" ".join(sys.argv)
current_user=os.getlogin(),
host=platform.node(),
command_line=" ".join(sys.argv),
)
startup_log.save()
retain_startup_log()
Expand Down

0 comments on commit 7602d50

Please sign in to comment.