Skip to content

Commit

Permalink
Renamed function
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsaturn committed Aug 2, 2024
1 parent 5c318f9 commit 44635a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class OneClickAppDeploymentHelper {
})

const overrideYaml =
DockerComposeToServiceOverride.convertComposeToService(
DockerComposeToServiceOverride.convertUnconsumedComposeParametersToServiceOverride(
dockerComposeService
)

Expand Down
24 changes: 15 additions & 9 deletions src/utils/DockerComposeToServiceOverride.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ import { IDockerComposeService } from '../models/IOneClickAppModels'
import Utils from './Utils'

export default class DockerComposeToServiceOverride {
static convertComposeToService(compose: IDockerComposeService) {
// NOTE:
// Port, replicas, env vars, volumes, and image are supplied through CapRover definition
// network will be set to captain-overlay
// restart_policy is not generally needed, by default docker services restart automatically
// ----
// Only parse parameters that are not from the aforementioned list.
// The only useful parameter that we are parsing at the moment is hostname: https://github.com/caprover/caprover/issues/404

/**
* Converts the unsupported docker compose parameters to CapRover service override definition.
* Port, replicas, env vars, volumes, and image are supplied through CapRover definition,
* network will be set to captain-overlay restart_policy is not generally needed,
* by default docker services restart automatically.
* Only parse parameters that are not from the aforementioned list.
* The only useful parameter that we are parsing at the moment is hostname: https://github.com/caprover/caprover/issues/404
*
* @param docker compose service definition
* @returns the override service definition in yaml format
*/
static convertUnconsumedComposeParametersToServiceOverride(
compose: IDockerComposeService
) {
const overrides = [] as any[]
overrides.push(DockerComposeToServiceOverride.parseHostname(compose))
// Add more overrides here if needed

let mergedOverride = {} as any
overrides.forEach((o) => {
Expand Down

1 comment on commit 44635a3

@guilh22
Copy link
Contributor

@guilh22 guilh22 commented on 44635a3 Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that is indeed more clear

Please sign in to comment.