ionic-team / trapeze

The mobile project configuration toolbox. Manage native iOS, Android, Ionic/Capacitor, React Native, and Flutter apps through a simple YAML format.
https://trapeze.dev
Other
328 stars 40 forks source link

how to use base64 decode? #203

Open reslear opened 1 year ago

reslear commented 1 year ago

good afternoon, @mlynch thx for https://github.com/ionic-team/trapeze/issues/105 :) do we have some kind of easy way to decode a base64 string?

for example $GOOGLE_SERVICE_PLIST_RAW it's more convenient to store in base64, but you have to decode it.

I suggest to do it:

  1. automatically value -> base64 === value
  2. or add from key with enumbase64.
platforms:
  ios:
    targets:
      App:
        plist:          
          - file: GoogleService-Info.plist
            xml: $GOOGLE_SERVICE_PLIST_RAW
            # add `from` attribute 
            from: base64

nodejs:

const value = Buffer.from(process.env.GOOGLE_SERVICE_PLIST_RAW, 'base64').toString(
  'ascii'
)

browser:

const value = atob(process.env.GOOGLE_SERVICE_PLIST_RAW)
reslear commented 7 months ago

also my current solution is:

# prebuid.sh

GOOGLE_SERVICE_PLIST_RAW=$(echo $GOOGLE_SERVICE_PLIST_RAW | base64 -d)
pnpm exec trapeze run trapeze-config.yml -y