@@ -4,12 +4,19 @@ import {
44 ROFL_8004_SERVICE_ENV_PREFIX ,
55 ROFL_8004_SERVICE_NAME ,
66 ROFL_8004_SUPPORTED_CHAINS ,
7+ ROFL_8004_VOLUME_NAME ,
78} from '../constants/rofl-8004.ts'
89import { RoflInstance } from '../nexus/generated/api.ts'
910import { AppData , ERC8004FormData } from '../pages/CreateApp/types.ts'
1011import * as yaml from 'yaml'
1112import { parse } from 'yaml'
1213
14+ interface ComposeFile {
15+ services : Record < string , unknown >
16+ volumes ?: Record < string , unknown | null >
17+ [ key : string ] : unknown
18+ }
19+
1320export const fromMetadataToAgentMetadata = (
1421 metadata : RoflInstance [ 'metadata' ] ,
1522) : { chainId : number | null ; agentId : bigint | null ; chainName : string | null } | null => {
@@ -41,7 +48,7 @@ export const hasRofl8004ServiceSecrets = (appData: AppData) => {
4148}
4249
4350export const addRofl8004ServiceToCompose = ( composeYaml : string , appData : AppData ) : string => {
44- const compose = parse ( composeYaml )
51+ const compose = parse ( composeYaml ) as ComposeFile
4552
4653 const environment = Object . keys ( appData . inputs ?. secrets ?? { } )
4754 . filter ( key => key . toUpperCase ( ) . startsWith ( ROFL_8004_SERVICE_ENV_PREFIX ) )
@@ -71,8 +78,13 @@ export const addRofl8004ServiceToCompose = (composeYaml: string, appData: AppDat
7178 image : ROFL_8004_DOCKER_IMAGE ,
7279 platform : 'linux/amd64' ,
7380 environment,
74- volumes : [ '/run/rofl-appd.sock:/run/rofl-appd.sock' ] ,
81+ volumes : [ '/run/rofl-appd.sock:/run/rofl-appd.sock' , `${ ROFL_8004_VOLUME_NAME } :/root/.rofl-8004` ] ,
82+ }
83+
84+ if ( ! compose . volumes ) {
85+ compose . volumes = { }
7586 }
87+ compose . volumes [ ROFL_8004_VOLUME_NAME ] = null
7688
7789 return yaml . stringify ( compose )
7890}
0 commit comments