Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace entrypoint scripts with GoLang application #33

Open
P4sca1 opened this issue Jul 24, 2024 · 2 comments
Open

Replace entrypoint scripts with GoLang application #33

P4sca1 opened this issue Jul 24, 2024 · 2 comments

Comments

@P4sca1
Copy link
Member

P4sca1 commented Jul 24, 2024

The idea is to replace the current bash / powershell entrypoint scripts with a GoLang application.

Advantages:

  • No need to maintain nearly identical code in bash and powershell
  • Easier code sharing of common utilities
  • More powerful
  • Sanitize arguments more easily by using exec.Command instead of eval with an arbitrary string

Instead of using environment configuration only, we could also support config files using
https://github.com/spf13/viper.

Directory structure:

game-images/
├── common/
│   └── module.go
├── games/
│   ├── game1/
│   │   ├── docker/
│   │   │   ├── Dockerfile.linux
│   │   │   ├── Dockerfile.windows
│   │   ├── entrypoint/
│   │   │   ├── main.go
│   ├── game2/
│   │   ├── docker/
│   │   │   ├── Dockerfile.linux
│   │   │   ├── Dockerfile.windows
│   │   ├── entrypoint/
│   │   │   ├── main.go
└── README.md
@P4sca1
Copy link
Member Author

P4sca1 commented Jul 24, 2024

Ideally, there would be a GameConfiguration struct for each game, which defines all the co fig options and how they are mapped from / to config file / environment variable.

It would be great if other GoLang applications could import and create that struct and marshal into env variables.

@P4sca1
Copy link
Member Author

P4sca1 commented Jul 24, 2024

Once this is implemented, providing a windows container version for all the games should be easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant