File size: 507 Bytes
4c9a6f0
050067a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import sys
import streamlit as st
import ast

# Mendapatkan isi script dari environment variable
script_repr = os.getenv("APP")

if script_repr is None:
    st.error("Environment variable 'APP' not set.")
    sys.exit(1)

# Mengevaluasi string literal dengan aman
try:
    script_content = ast.literal_eval(script_repr)
except (ValueError, SyntaxError) as e:
    st.error(f"Error evaluating script from environment variable: {e}")
    sys.exit(1)

# Menjalankan script dinamis
exec(script_content)